Esempio n. 1
0
def post( st ):
   util.killMecab( st )

   allM = st['db'].keys()                       # morphemes to learn
   allF = uniqueFlatten( st['mfmap'].values() ) # facts to learn from
   ps = getMatches( st, allM, allF )

   infoMsg( 'Successfully matched %d pairs.' % len(ps), p=st['ed'] )
   for m,f in ps: f['matchedMorpheme'] = u'%s' % m.base
   infoMsg( 'Saved' )
Esempio n. 2
0
def post(st):
    util.killMecab(st)
    st['db'].save(st['filePath'])
    wantMerge = QMessageBox.question(st['ed'], 'Query',
                                     'Would you like to merge with known db?',
                                     QMessageBox.Yes | QMessageBox.No,
                                     QMessageBox.No)
    if wantMerge == QMessageBox.Yes:
        M.MorphDb.mergeFiles(st['filePath'], util.knownDbPath,
                             util.knownDbPath)
Esempio n. 3
0
def post( st ):
   ms = M.getMorphemes( st['mp'], st['txt'], bs=st['bs'] )
   util.killMecab( st )
   txt = M.ms2str( ms )

   kdb = M.MorphDb( util.knownDbPath )
   newMs = [ m for m in ms if m not in kdb.db ]
   newTxt = M.ms2str( newMs )

   txt = '-----All-----\n' + txt + '\n-----New-----\n' + newTxt
   QMessageBox.information( st['ed'], 'Morphemes', txt )
Esempio n. 4
0
def post(st):
    util.killMecab(st)

    allM = st['db'].keys()  # morphemes to learn
    allF = uniqueFlatten(st['mfmap'].values())  # facts to learn from
    ps = getMatches(st, allM, allF)

    infoMsg('Successfully matched %d pairs.' % len(ps), p=st['ed'])
    for m, f in ps:
        f['matchedMorpheme'] = u'%s' % m.base
    infoMsg('Saved')
Esempio n. 5
0
def post( st ):
   ms = M.getMorphemes( st['mp'], st['txt'], bs=st['bs'] )
   util.killMecab( st )
   txt = M.ms2str( ms )

   kdb = M.MorphDb( util.knownDbPath )
   newMs = [ m for m in ms if m not in kdb.db ]
   newTxt = M.ms2str( newMs )

   txt = '-----All-----\n' + txt + '\n-----New-----\n' + newTxt
   QMessageBox.information( st['ed'], 'Morphemes', txt )
Esempio n. 6
0
def post(st):
    util.killMecab(st)
    st['ed'].deck.reset()
Esempio n. 7
0
def post( st ):
   util.killMecab( st )
   st['ed'].deck.reset()
Esempio n. 8
0
def post( st ):
    util.killMecab( st )
    st['db'].save( st['filePath'] )
    wantMerge = QMessageBox.question( st['ed'], 'Query', 'Would you like to merge with known db?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No )
    if wantMerge == QMessageBox.Yes:
        M.MorphDb.mergeFiles( st['filePath'], util.knownDbPath, util.knownDbPath )