Esempio n. 1
0
def pre( ed ):
   path = QFileDialog.getOpenFileName( caption='Open db', directory=util.knownDbPath )
   if not path: return 'BAIL'
   bs = util.getBlacklist( ed )

   db = M.MorphDb( path ).db
   return { 'mp':M.mecab(None), 'fmmap':{}, 'mfmap':{}, 'db':db, 'bs':bs, 'ed':ed }
Esempio n. 2
0
def pre( ed ):
   tags, ok = QInputDialog.getText( ed, 'Enter Tags', 'Tags', QLineEdit.Normal, 'myMorph' )
   if not ok: return
   msStr, ok = QInputDialog.getText( ed, 'Enter morphemes', 'Morphemes', QLineEdit.Normal, '' )
   if not ok: return
   bs = util.getBlacklist( ed )
   ms = [ tuple( row.split('\t') ) for row in msStr.split('\n') ]
   return { 'mp':M.mecab(None), 'ms':ms, 'tags':tags, 'bs':bs, 'ed':ed }
Esempio n. 3
0
def pre( ed ):
   tags, ok = QInputDialog.getText( ed, 'Enter Tags', 'Tags', QLineEdit.Normal, 'myMorph' )
   if not ok or not tags: return 'BAIL'
   path = QFileDialog.getOpenFileName( caption='Open db', directory=util.knownDbPath )
   if not path: return 'BAIL'
   bs = util.getBlacklist( ed )

   db = M.MorphDb( path )
   return { 'mp':M.mecab(), 'db':db, 'tags':unicode(tags), 'bs':bs, 'ed':ed }
Esempio n. 4
0
def pre(ed):
    path = QFileDialog.getOpenFileName(caption='Open db',
                                       directory=util.knownDbPath)
    if not path: return 'BAIL'
    bs = util.getBlacklist(ed)

    db = M.MorphDb(path).db
    return {
        'mp': M.mecab(None),
        'fmmap': {},
        'mfmap': {},
        'db': db,
        'bs': bs,
        'ed': ed
    }
Esempio n. 5
0
def pre(ed):
    tags, ok = QInputDialog.getText(ed, 'Enter Tags', 'Tags', QLineEdit.Normal,
                                    'myMorph')
    if not ok or not tags: return 'BAIL'
    path = QFileDialog.getOpenFileName(caption='Open db',
                                       directory=util.knownDbPath)
    if not path: return 'BAIL'
    bs = util.getBlacklist(ed)

    db = M.MorphDb(path)
    return {
        'mp': M.mecab(),
        'db': db,
        'tags': unicode(tags),
        'bs': bs,
        'ed': ed
    }
Esempio n. 6
0
def pre( ed ):
   if not util.requireKnownDb(): return 'BAIL'
   bs = util.getBlacklist( ed )
   return { 'bs':bs, 'kdb': m.loadDb( util.knownDbPath ), 'mp':m.mecab(None) }
Esempio n. 7
0
def pre( ed ):
   if not util.requireKnownDb(): return 'BAIL'
   bs = util.getBlacklist( ed )
   return { 'ed':ed, 'txt':'', 'bs':bs }
Esempio n. 8
0
def pre( ed ):
   if not util.requireKnownDb(): return 'BAIL'
   bs = util.getBlacklist( ed )
   return { 'ed':ed, 'txt':'', 'bs':bs, 'mp':M.mecab() }