Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pymathics/natlang/linguistic_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
Linguistic Data

See <url>:WMA link:https://reference.wolfram.com/language/guide/LinguisticData.html</url> guide.
See the corresponding <url>:WMA:https://reference.wolfram.com/language/guide/LinguisticData.html</url> guide.

"""
# This module uses nltk.
Expand Down Expand Up @@ -66,7 +66,7 @@ class DictionaryLookup(_WordListBuiltin):
= {baker, baker's dozen, baker's eczema}
"""

summary_text = "Lookup words matching a pattern in a dictionary"
summary_text = "lookup words matching a pattern in our word dictionary"

def compile(self, pattern, evaluation):
re_patt = to_regex(pattern, evaluation)
Expand Down Expand Up @@ -131,7 +131,7 @@ class DictionaryWordQ(_WordNetBuiltin):
= False
"""

summary_text = "Check if a word is in the dictionary"
summary_text = "check if a word is in our word dictionary"

def eval(self, word, evaluation: Evaluation, options: dict):
"DictionaryWordQ[word_String, OptionsPattern[DictionaryWordQ]]"
Expand Down Expand Up @@ -170,7 +170,7 @@ class RandomWord(_WordListBuiltin):
</dl>
"""

summary_text = "generate a random word of a given kind"
summary_text = "generate a random word"

def _random_words(self, type, n, evaluation: Evaluation, options: dict):
words = self._words(self._language_name(evaluation, options), type, evaluation)
Expand Down Expand Up @@ -412,7 +412,7 @@ class WordList(_WordListBuiltin):
Evaluate the average length over all the words in the dictionary:
>> N[Mean[StringLength /@ WordList[]], 3]
= 11.6
Now, restricted to adjetives:
Now, restricted to adjectives:
>> N[Mean[StringLength /@ WordList["Adjective"]], 2]
= 9.3
"""
Expand Down
1 change: 1 addition & 0 deletions pymathics/natlang/nltk.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from mathics.core.evaluation import Evaluation
from mathics.core.symbols import strip_context

# Don't consider this for user documentation
no_doc = True


Expand Down
4 changes: 3 additions & 1 deletion pymathics/natlang/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

Text Normalization

See <url>:WMA link: https://reference.wolfram.com/language/guide/TextNormalization.html</url> guide.
See the corresponding <url>
:WMA:
https://reference.wolfram.com/language/guide/TextNormalization.html</url> guide.


This module uses spacy as a backend.
Expand Down
13 changes: 6 additions & 7 deletions pymathics/natlang/textual_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"""
Text Analysis

<url>:See WMA guide:https://reference.wolfram.com/language/guide/TextAnalysis.html</url>
See the corresponding <url>:WMA:
https://reference.wolfram.com/language/guide/TextAnalysis.html</url> guide.
"""

# This module uses both enchant, nltk and spacy. Maybe we want to split this further.
Expand Down Expand Up @@ -88,7 +89,7 @@ class SpellingCorrectionList(Builtin):

_dictionaries = {}

summary_text = "Look for spelling correction candidates of a word"
summary_text = "look for spelling correction candidates of a word"

def eval(
self, word: String, evaluation: Evaluation, options: dict
Expand Down Expand Up @@ -130,7 +131,7 @@ class WordCount(_SpacyBuiltin):
= 4
"""

summary_text = "Count the words in a text"
summary_text = "count words in a text"

def eval(self, text, evaluation: Evaluation, options: dict):
"WordCount[text_String, OptionsPattern[WordCount]]"
Expand All @@ -154,9 +155,7 @@ class WordFrequency(_SpacyBuiltin):

## Problem with import for certain characters in the text.
## >> text = Import["ExampleData/EinsteinSzilLetter.txt"];
>> text = "I have a dairy cow, it's not just any cow. \
She gives me milkshake, oh what a salty cow. She is the best \
cow in the county.";
>> text = "I have a dairy cow, it's not just any cow. She gives me milkshake, oh what a salty cow. She is the best cow in the county.";

>> WordFrequency[text, "a" | "the"]
= 0.121212
Expand Down Expand Up @@ -232,7 +231,7 @@ class WordSimilarity(_SpacyBuiltin):
"idxfmt": "Indices must be integers or lists of integers of the same length.",
},
)
summary_text = "Measure the similarity of two texts"
summary_text = "measure similarity of two texts"

def eval(
self, text1: String, text2: String, evaluation: Evaluation, options: dict
Expand Down
3 changes: 3 additions & 0 deletions pymathics/natlang/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
utils
"""

# Don't consider this for user documentation
no_doc = True


def merge_dictionaries(a, b):
c = a.copy()
Expand Down