Skip to content

Commit

Permalink
removed ngram model package, pending resolution of issues nltk#133, n…
Browse files Browse the repository at this point in the history
…ltk#157, nltk#167, nltk#367, nltk#380, nltk#388, nltk#396, nltk#602, nltk#603; package saved in a new branch
  • Loading branch information
stevenbird committed Feb 20, 2014
1 parent bc09f9c commit 052b5ab
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 302 deletions.
3 changes: 1 addition & 2 deletions nltk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
from nltk.classify import *
from nltk.inference import *
from nltk.metrics import *
from nltk.model import *
from nltk.parse import *
from nltk.tag import *
from nltk.tokenize import *
Expand Down Expand Up @@ -172,7 +171,7 @@

from nltk import align, ccg, chunk, classify, collocations
from nltk import data, featstruct, grammar, inference, metrics
from nltk import misc, model, parse, probability, sem, stem
from nltk import misc, parse, probability, sem, stem
from nltk import tag, text, tokenize, tree, treetransforms, util

# override any accidentally imported demo
Expand Down
8 changes: 0 additions & 8 deletions nltk/model/__init__.py

This file was deleted.

40 changes: 0 additions & 40 deletions nltk/model/api.py

This file was deleted.

236 changes: 0 additions & 236 deletions nltk/model/ngram.py

This file was deleted.

Empty file removed nltk/model/t.py
Empty file.
16 changes: 0 additions & 16 deletions nltk/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from nltk.probability import FreqDist, LidstoneProbDist
from nltk.probability import ConditionalFreqDist as CFD
from nltk.util import tokenwrap, LazyConcatenation
from nltk.model import NgramModel
from nltk.metrics import f_measure, BigramAssocMeasures
from nltk.collocations import BigramCollocationFinder
from nltk.compat import python_2_unicode_compatible, text_type
Expand Down Expand Up @@ -375,21 +374,6 @@ def readability(self, method):
# code from nltk_contrib.readability
raise NotImplementedError

def generate(self, length=100):
"""
Print random text, generated using a trigram language model.
:param length: The length of text to generate (default=100)
:type length: int
:seealso: NgramModel
"""
if '_trigram_model' not in self.__dict__:
print("Building ngram index...")
estimator = lambda fdist, bins: LidstoneProbDist(fdist, 0.2)
self._trigram_model = NgramModel(3, self, estimator=estimator)
text = self._trigram_model.generate(length)
print(tokenwrap(text))

def similar(self, word, num=20):
"""
Distributional similarity: find other words which appear in the
Expand Down

0 comments on commit 052b5ab

Please sign in to comment.