All Questions
17 questions
4
votes
4
answers
2k
views
Matching words from a text with a big list of keywords in Python
I implemented the following code to retrieve medication names from a given text (prescription_text in the code). It works by matching words in the text with a list ...
1
vote
2
answers
321
views
Replacing banned words from a given text
The following algorithm is used to find a word from Blacklisted words in a string (called text) and replace these words with censored text, as shown in the example.
Example:
...
2
votes
1
answer
257
views
Extract regular words from string but retain all other elements and record their type
This snippet processes every regular (\w+) word in a text and reinserts the processed version:
...
2
votes
2
answers
910
views
Replace string based on multiple rules, don't replace same section twice
Given a 2-column CSV dictionary file that contains translation of certain words, this c# code needs to replace the first occurrence of a word in the dictionary.
Once a segment of string has been ...
3
votes
3
answers
160
views
Java regex and replaceAll to extract strings into objects
I have this method that creates book objects. I pass a list of strings (size 60000+) that contain the information of the book, the function then goes and extracts the information makes the book object ...
2
votes
1
answer
747
views
Strong Password Checker (Python)
Problem
Write a program to return True, if a string is a strong password.
A password is considered strong if below conditions are all met:
It should have at least ...
0
votes
2
answers
155
views
Sanitizing name strings using PHP
Functionality:
This method removes a list of specific terms (e.g., LLC, INC, Inc, Company, etc.) from a list of public companies names. It is part of a class that can be viewed in this link.
I'd ...
3
votes
3
answers
231
views
Retrieve words from dictionary when they meet letter requirements
I have a set of functions that retrieve words from some arbitrary dictionary based on what letters they have. For example, this function gets words that use only the specified letters:
...
4
votes
1
answer
145
views
GNU Make variable relationship graph using Python
This program runs through a preprocessed makefile (make --print-data-base | python make_graph.py [options]) to assemble a directed graph of its variables.
I ...
4
votes
3
answers
346
views
Remove repetitive strings from a given sentence efficiently
I recently gave a test on HackerRank:
Given a string, return the most concise string that can be formed from it.
For example:
...
7
votes
5
answers
3k
views
CodeEval Challenge: Remove specified characters from a string
Question
Write a program which removes specific characters from a string.
The first argument is a path to a file. The file contains the source
strings and the characters that need to be ...
6
votes
0
answers
873
views
Parsing Lua 5.2 strings with patterns
I wrote some code to parse Lua 5.2 strings in Lua 5.1, using patterns. It works perfectly as far as I tested.
...
2
votes
2
answers
709
views
Performance of RegExp vs Rune Loop
I was recently talking to someone about a function I wrote to mimic (very basically) the string interpolation function String.Format() found in the C# language. ...
11
votes
4
answers
1k
views
What would be preferred aesthetically and performance wise?
Which one of these two would you prefer writing in your code?
This:
...
5
votes
1
answer
1k
views
More efficient way to make a Twitter status in a string of just words
I am making an application where I will be fetching tweets and storing them in a database. I will have a column for the complete text of the tweet and another where only the words of the tweet will ...