import sys import fnextracter args = sys.argv path = args[1] IDs = fnextracter.ExtractID(path) Calls = fnextracter.ExtractVerb(path) print(IDs) elements = [] slash = 0 while slash < 2: path = path[:-1] if path[-1] == '/': slash += 1 for i in IDs: print(str(i)) a = fnextracter.ExtractElements(path+'lu/lu'+str(i)+'.xml') for j in a: exist = False for k in range(len(elements)): if elements[k][0] == j[0]: elements[k].extend(j[2:]) exist = True if exist == False: elements.append(j) print(Calls) print(elements)
IDs = fnex.ExtractID(fnframe) if len(IDs) == 0: print("no example in " + f.name) data[f.name] = None continue #print(IDs) elems = [] slash = 0 while slash < 2: fnframe = fnframe[:-1] if fnframe[-1] == '/': slash += 1 for i in range(0, len(IDs)): newElems = fnex.ExtractElements(fnframe + 'lu/lu' + str(IDs[i]) + '.xml') #print(newElems) #print(elems) if len(elems) == 0 and len(newElems) > 0: elems.extend(newElems) continue exist = False for j in newElems: for k in range(len(elems)): if j[0] == elems[k][0]: #print(j[2:]) elems[k].extend(j[2:]) exist = True break #用例に含まれるかは関係なく全部の意味役割のタグが各luに書いてあるはずだからこれいるかどうかわからん
for f in FNscores: #print(args) #print(args[3] + '/' + f[0]) #ID = fnex.searchLu_Verb(args[3] + '/' + f[0], midashi) #/を削って前の階層に行く """ path = args[3] slash = 0 while slash < 1: path = path[:-1] if path[-1] == '/': slash += 1 """ #その動詞のFramenetの用例と格解析結果からの格の対応をとる luFilePath = args[3] + '/' + f[0] elements[f[0]] = fnex.ExtractElements(luFilePath) depends[f[0]] = fnex.getRoleReration(midashi, luFilePath, "/home/oyanagi/rerater/luReibuns") reibuns[f[0]] = fnex.ExtractReibun(luFilePath) print(f[0]) print(elements[f[0]]) #print(elements) #print("ele") compareList = [] for kfnum in range(min(kfex.getFrameNum(args[1]), 50)): compareDict = {}
import fnextracter as fnex import os import sys import gensim args = sys.argv notInVocab = 0 #embedding自体はいらんけど語彙の確認のためにいる embedding = gensim.models.KeyedVectors.load_word2vec_format('./model.vec') for f in os.scandir(path=args[1]): elems = fnex.ExtractElements(args[1] + "/" + f.name) # print(vs) print(f.name, file=sys.stderr) # とても汚いけど標準出力は吸われるのでこうする exist = False additional = [] for role in elems: if role[1] == "Core": for elem in role[2:]: if elem not in embedding: if not exist: print(f.name) exist = True notInVocab += 1 print(elem)
print(FNscores) #候補のスコア計算して一番いいやつを正解とする yorei = kfex.ExtractYorei(args[1]) depends = {} ukemiDepends = {} elements = {} reibuns = {} for f in FNscores: e = {} #その動詞のFramenetの用例と格解析結果からの格の対応をとる luFilePath = args[3] + '/' + f[0] e["lu"] = fnex.ExtractElements(luFilePath) framePath = luFilePath framePath = pm.movePath(framePath, 2) framePath = framePath + "/frame/" + fnex.ExtractFrame(luFilePath) + ".xml" subElements = fnex.ExtractSubElements(luFilePath) frameReibunElements = fnex.ExtractElements_Frame(framePath) for i in range(len(subElements)): for j in range(len(frameReibunElements)): if len(frameReibunElements[j]) > 2: if subElements[i][0] == frameReibunElements[j][0]: subElements[i].extend(frameReibunElements[j][2:]) else: subElements.append(frameReibunElements[j])