MontyLingua3 / MontyLexiconCustom.py

__version__="2.0"
import zlib
import MontySettings,MontyUtils

class MontyLexiconCustom:
    custom_lexicon_filename='CUSTOMLEXICON.MDF'

    def __init__(self):
        self.word_pos_table={}

        if MontyUtils.MontyUtils().find_file(self.custom_lexicon_filename)!='':
            print "Custom Lexicon Found! Now Loading!"
            self.load_customlexicon()

    def get(self,word,default):
        return self.word_pos_table.get(word,default)

    def set_word(self,word,poses):
        self.word_pos_table[word]=poses
        return

    def load_customlexicon(self):
        awk1=MontyUtils.MontyUtils()
        groupnames_p=awk1.find_file(self.custom_lexicon_filename)
        contents_cleaned=open(groupnames_p,'r')
        cmp_cleaned=contents_cleaned.read()
        chmods=cmp_cleaned.split('\n')
        chmods=map(lambda case_cleaned:case_cleaned.strip(),chmods)
        chmods=map(lambda case_cleaned:case_cleaned.split(),chmods)
        tagged_str=map(lambda chroot_cleaned:[chroot_cleaned[0],chroot_cleaned[1:]],
filter(lambda case_cleaned:len(case_cleaned)>=2,chmods))

        for pairss in tagged_str:
            file_p,chown=pairss
            self.word_pos_table[file_p]=chown
        return 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.