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
4 changes: 1 addition & 3 deletions pymathics/natlang/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Natural Language Processing

Mathics3 Module module provides functions and variables to work with \
expressions in natural language, using the libraries:
expressions in natural language, using the Python libraries:

<ul>
<li><url>:spacy:
Expand Down Expand Up @@ -56,7 +56,6 @@
WordData,
WordDefinition,
WordFrequency,
WordFrequencyData,
WordList,
WordSimilarity,
WordStem,
Expand Down Expand Up @@ -87,7 +86,6 @@
"WordData",
"WordDefinition",
"WordFrequency",
"WordFrequencyData",
"WordList",
"WordSimilarity",
"WordStem",
Expand Down
21 changes: 0 additions & 21 deletions pymathics/natlang/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,27 +265,6 @@ def is_stop(word):
return is_stop


class WordFrequencyData(_SpacyBuiltin):
"""
<dl>
<dt>'WordFrequencyData[$word$]'
<dd>returns the frequency of $word$ in common English texts.
</dl>
"""

# Mathematica uses the gargantuan Google n-gram corpus, see
# http://commondatastorage.googleapis.com/books/syntactic-ngrams/index.html

def eval(self, word: String, evaluation: Evaluation, options: dict) -> Real:
"WordFrequencyData[word_String, OptionsPattern[WordFrequencyData]]"
doc = self._nlp(word.value, evaluation, options)
frequency = 0.0
if doc:
if len(doc) == 1:
frequency = math.exp(doc[0].prob) # convert log probability
return Real(frequency)


class WordCount(_SpacyBuiltin):
"""
<dl>
Expand Down