<jupyter_start><jupyter_text>It's then necessary to check if Acromine produced the correct results. We must fix errors manually<jupyter_code>top = miners['DGK'].top()
top
longforms0 = miners['FRT'].get_longforms()
list(enumerate(longforms0))
longforms0 = [x for i, x in enumerate(longforms0) if i not in [0, 1, 2, 3, 4, 7]]
list(enumerate(top))
longforms0.extend([(longform, score) for i, (longform, score) in enumerate(top)
                   if i in [3, 5, 8, 9, 11, 12, 13, 32, 33, 35]])
longforms0
longforms0.sort(key=lambda x: -x[1])
longforms, scores = zip(*longforms0)
longforms
grounding_map = {}
names = {}
for longform in longforms:
    grounding = gilda_ground(longform)
    if grounding[0]:
        grounding_map[longform] = f'{grounding[0]}:{grounding[1]}'
        names[grounding_map[longform]] = grounding[2]
grounding_map
names
grounding_map, names, pos_labels = ground_with_gui(longforms, scores, grounding_map=grounding_map, names=names)
names
grounding_map
names['HGNC:7199'] = 'MOS'
names['HGNC:18234'] = 'MOCOS'
pos_labels.extend(['HGNC:7199', 'HGNC:18234'])
result = grounding_map, names, pos_labels
result
grounding_map, names, pos_labels = ({'female reproductive tract': 'ungrounded',
  'fischer rat thyroid': 'ungrounded',
  'fischer rat thyroid cells': 'ungrounded',
  'fisher rat thyroid': 'ungrounded',
  'flip recombinase target': 'ungrounded',
  'flippase recognition target': 'ungrounded',
  'flp recognition target': 'ungrounded',
  'flp recombinase target': 'ungrounded',
  'flp recombination target': 'ungrounded',
  'folate receptor target': 'ungrounded',
  'fractionated radiation therapy': 'ungrounded',
  'free running type': 'ungrounded',
  'rosa roxburghii tratt': 'ungrounded'},
 {},
 [])
names['HGNC:3763'] = 'FLT1'
pos_labels.append('HGNC:3763')
grounding_dict = {'FRT': grounding_map}
classifier = AdeftClassifier('FRT', pos_labels=pos_labels)
param_grid = {'C': [100.0], 'max_features': [10000]}
labeler = AdeftLabeler(grounding_dict)
corpus = labeler.build_from_texts(shortform_texts)
corpus.extend(entrez_texts)
texts, labels = zip(*corpus)
classifier.cv(texts, labels, param_grid, cv=5, n_jobs=8)
classifier.stats
disamb = AdeftDisambiguator(classifier, grounding_dict, names)
d = disamb.disambiguate(shortform_texts)
a = [(text, pred) for pred, text in zip(d, shortform_texts)if pred[0].startswith('HGNC')]
a[4]
a[1]
disamb.dump('MOS', '../results')
from adeft.disambiguate import load_disambiguator
d = load_disambiguator('FES', '../results')
d.disambiguate(texts[0])
print(d.info())
a = load_disambiguator('AR')
a.disambiguate('Androgen')
logit = d.classifier.estimator.named_steps['logit']
logit.classes_
model_to_s3(disamb)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14892830746489283, 'fraction_numerical': 0.028824833702882482, 'mean_word_length': 6.646892655367232, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '124079', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 1056, 'n_tokens_neox': 991, 'n_words': 224, 'path': 'notebooks/I-R_model.ipynb', 'repo_name': 'steppi/adeft_indra', 'size': '2706'}