hal.strings package

Submodules

hal.strings.models module

String models

class hal.strings.models.String(string)[source]

Bases: object

Models string

convert_accents()[source]

Removes accents from text

Returns:input with converted accents chars
is_well_formatted()[source]

Checks if string is good formatted

Returns:True iff string is good formatted
remove_all(token)[source]

Removes all occurrences of token

Parameters:token – string to remove
Returns:input without token
remove_control_chars()[source]

Removes controls chars from text

Returns:input except controls chars
remove_escapes()[source]

Removes everything except number and letters from string

Returns:All numbers and letters in string
remove_non_ascii()[source]

Removes non-ansi chars from text

Returns:input except non-ansi chars
strip_bad_html()[source]

Strips string of all HTML elements

Returns:Given string with raw HTML elements removed

hal.strings.utils module

Typical operations on strings made easy

hal.strings.utils.convert2sentence_case(string, splitter='. ')[source]
hal.strings.utils.get_average_length_of_string(strings)[source]

Computes average length of words

Parameters:strings – list of words
Returns:Average length of word on list
hal.strings.utils.get_max_similar(string, lst)[source]

Finds most similar string in list

Parameters:
  • string – String to find
  • lst – Strings available
Returns:

Max similarity and index of max similar

hal.strings.utils.how_similar_are(str1, str2)[source]

Computes similarity between strings

Parameters:
  • str1 – First string
  • str2 – Second string
Returns:

Similarity of a VS b