refactor: remove useless if

This commit is contained in:
monoid 2022-02-14 22:23:35 +09:00
parent badedc3ab7
commit f8e7ed42b3

View File

@ -165,8 +165,7 @@ if __name__ == "__main__":
def getTags(lst: List[Sentence]): def getTags(lst: List[Sentence]):
for s in tqdm(lst): for s in tqdm(lst):
for e in s.detail: for e in s.detail:
if not e in vocab: vocab.add(e)
vocab.add(e)
print("get tags from train...") print("get tags from train...")
getTags(train) getTags(train)
print("get tags from dev...") print("get tags from dev...")
@ -183,6 +182,7 @@ if __name__ == "__main__":
v:str = "-".join(s) v:str = "-".join(s)
if not v in vocab: if not v in vocab:
print("could not found pair " ,v) print("could not found pair " ,v)
vocab.add(v)
tags = [{"name":"[PAD]","index":0}] tags = [{"name":"[PAD]","index":0}]
i = 1 i = 1