How to use the ngram.Corpus.Corpus function in ngram

To help you get started, we’ve selected a few ngram examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Ezhil-Language-Foundation / open-tamil / tests / unigram_tests.py View on Github external
def test_basic_unigram_counts(self):
        z = Corpus("data/ex.unicode")
        for letter in z.next_tamil_letter():
            #if ( LINUX ): print(letter)
            pass
        # LetterModels
        q = Unigram( "data/ex.unicode" )
        q.frequency_model( )
        if not PYTHON3:
            #if ( LINUX ):  print(unicode(q))
            pass
        else:
            #if ( LINUX ):  print( q )
            pass
        self.assertEqual( q.letter[u"ஷை"] + q.letter[u"சி"] , q.letter[u"ந"] )
        del z, q
github Ezhil-Language-Foundation / open-tamil / ngram / LetterModels.py View on Github external
def __init__(self,filename):
        self.letter = dict()
        self.letter.update(zip( tamil.utf8.tamil_letters,
                                map(lambda x : 0, tamil.utf8.tamil_letters) ) )
        self.corpus = Corpus( filename )
github Ezhil-Language-Foundation / open-tamil / ngram / LetterModels.py View on Github external
def update_file(self,filename):
        self.corpus = Corpus( filename )