Skip to content
Snippets Groups Projects
Select Git revision
  • master
1 result

adataset.py

Blame
  • sample_conll.py 723 B
    """A message of shame -- documentation must be completed."""
    
    import poldeepner2.models
    
    ner = poldeepner2.models.load("conll-english-large-sq", device="cuda:0",
                                  resources_path="/tmp")
    
    sentences = ["""(CNN)In a new criminal court case against a woman alleged to
    have entered the US Capitol on January 6, the FBI noted that a tipster
    raised the possibility of a laptop being stolen from House Speaker Nancy
    Pelosi's office to potentially sell to Russia."""]
    
    for sentence in sentences:
        print("-" * 20)
        print(sentence)
        for name in ner.process_text(sentence):
            name_range = "%d:%d" % (name.start, name.end)
            print("%-8s %-20s %s" % (name_range, name.label, name.text))