<commit_before>#!/usr/bin/env python
"""
cat wekex_test_plain | python ../notebooks/kilogram/mapreduce/wikipedia/resolve_entities.py > wekex_test_linked
"""

import sys
from kilogram.dataset.dbpedia import NgramEntityResolver

ner = NgramEntityResolver("dbpedia_types.txt", "dbpedia_uri_excludes.txt", "dbpediadb_lower.txt", "dbpedia_ontology.owl")

for line in sys.stdin:
    line = line.strip()
    # split the line into words
    new_words = ner.resolve_entities(line.split())
    new_line = ' '.join(new_words)
    print new_line<commit_msg>minor<commit_after>#!/usr/bin/env python
"""
cat wekex_test_plain | python ../notebooks/kilogram/mapreduce/wikipedia/resolve_entities.py > wekex_test_linked
"""

import sys
from kilogram.dataset.dbpedia import NgramEntityResolver

ner = NgramEntityResolver("/home/roman/dbpedia/dbpedia_types.txt", "/home/roman/dbpedia/dbpedia_uri_excludes.txt", "/home/roman/dbpedia/dbpedia_lower_includes.txt", "/home/roman/dbpedia/dbpedia_redirects.txt", "/home/roman/dbpedia/dbpedia_2015-04.owl")

for line in sys.stdin:
    line = line.strip()
    # split the line into words
    new_words = ner.resolve_entities(line.split())
    new_line = ' '.join(new_words)
    print new_line
{'fraction_non_alphanumeric': 0.1261335531739489, 'fraction_numerical': 0.00494641384995878, 'mean_word_length': 5.00990099009901, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5987336', 'n_tokens_mistral': 446, 'n_tokens_neox': 436, 'n_words': 70}