Skip to content

Commit

Permalink
change other person ner labels to PERSON
Browse files Browse the repository at this point in the history
  • Loading branch information
xxyzz committed Jul 13, 2021
1 parent 12adf50 commit 4e9eca9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
from calibre.customize import InterfaceActionBase

VERSION = (3, 10, 0)
VERSION = (3, 10, 1)


class WordDumbDumb(InterfaceActionBase):
Expand Down
2 changes: 2 additions & 0 deletions parse_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ def find_named_entity(start, x_ray, doc, is_kfx):
for ent in doc.ents:
if ent.label_ not in labels:
continue
if ent.label_ in ['PER', 'persName']:
ent.label_ = 'PERSON'

if is_kfx:
ent_start = start + len(doc.text[:ent.start_char])
Expand Down
4 changes: 2 additions & 2 deletions x_ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, conn, lang):
self.terms_counter = Counter()
self.pending_terms = {}
self.pending_people = {}
self.lang = lang
self.wikipedia_api = f'https://{lang}.wikipedia.org/w/api.php'

import requests
self.s = requests.Session()
Expand Down Expand Up @@ -65,7 +65,7 @@ def insert_wiki_intro(self, is_people, title, intro):
self.conn, (intro, title, 1, entity['id']))

def search_wikipedia(self, is_people, dic):
r = self.s.get(f'https://{self.lang}.wikipedia.org/w/api.php',
r = self.s.get(self.wikipedia_api,
params={'titles': '|'.join(dic.keys())})
data = r.json()
converts = {}
Expand Down

0 comments on commit 4e9eca9

Please sign in to comment.