NLP utilities
add_suffix(property_key, suffix)
Add a suffix to a property key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property_key
|
str
|
The property key to process. |
required |
suffix
|
int
|
The suffix to add. |
required |
Returns:
Type | Description |
---|---|
str
|
The property key with the suffix added. |
Source code in synalinks/src/utils/nlp_utils.py
is_plural(property_key)
Check if the last word of a property key is in plural form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property_key
|
str
|
The property key to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the last word is plural, False otherwise. |
Source code in synalinks/src/utils/nlp_utils.py
normalize_and_tokenize(text)
Normalize the text and tokenize it into words.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The text to process. |
required |
Returns:
Type | Description |
---|---|
list
|
A list of normalized words. |
Source code in synalinks/src/utils/nlp_utils.py
normalize_text(text)
Normalize the text by converting to lowercase, removing articles, and removing punctuation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The text to normalize. |
required |
Returns:
Type | Description |
---|---|
str
|
The normalized text. |
Source code in synalinks/src/utils/nlp_utils.py
remove_articles(text)
Remove common English articles from the text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The text to process. |
required |
Returns:
Type | Description |
---|---|
str
|
The text with articles removed. |
Source code in synalinks/src/utils/nlp_utils.py
remove_numerical_suffix(property_key)
Remove the numerical suffix from a property key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property_key
|
str
|
The property key to process. |
required |
Returns:
Type | Description |
---|---|
str
|
The property key with the suffix removed. |
Source code in synalinks/src/utils/nlp_utils.py
remove_punctuation(text)
Remove punctuation from the text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The text to process. |
required |
Returns:
Type | Description |
---|---|
str
|
The text with punctuation removed. |
to_plural(word)
Convert a singular word to its plural form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
word
|
str
|
The singular word to convert. |
required |
Returns:
Type | Description |
---|---|
str
|
The plural form of the word. |
Source code in synalinks/src/utils/nlp_utils.py
to_plural_property(property_key)
Convert the last word of a property key to its plural form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property_key
|
str
|
The property key to convert. |
required |
Returns:
Type | Description |
---|---|
str
|
The property key with the last word in plural form. |
Source code in synalinks/src/utils/nlp_utils.py
to_plural_without_numerical_suffix(property_key)
Convert a property key to its list (plural) form by removing the numerical suffix and converting to plural.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property_key
|
str
|
The property key to convert. |
required |
Returns:
Type | Description |
---|---|
str
|
The list (plural) form of the property key. |
Source code in synalinks/src/utils/nlp_utils.py
to_singular(word)
Convert a plural word to its singular form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
word
|
str
|
The plural word to convert. |
required |
Returns:
Type | Description |
---|---|
str
|
The singular form of the word. |
Source code in synalinks/src/utils/nlp_utils.py
to_singular_property(property_key)
Convert the last word of a property key to its singular form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property_key
|
str
|
The property key to convert. |
required |
Returns:
Type | Description |
---|---|
str
|
The property key with the last word in singular form. |
Source code in synalinks/src/utils/nlp_utils.py
to_singular_without_numerical_suffix(property_key)
Convert a property key to its base (singular) form by removing the numerical suffix and converting to singular.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property_key
|
str
|
The property key to convert. |
required |
Returns:
Type | Description |
---|---|
str
|
The base (singular) form of the property key. |