aditya140 / NLPTriples

Extract NLP (RDF )Triples from a sentence
MIT License
9 stars 1 forks source link

Code doesn't work => RuntimeError: dictionary changed size during iteration #5

Open paulpierre opened 3 years ago

paulpierre commented 3 years ago

I get the error "RuntimeError: dictionary changed size during iteration"

running a simple sentence with the following code:

from nlptriples import triples,setup rdf = triples.RDF_triple() sent = f'A dog is an animal. Dogs are good pets. A cat is an animal. Cats are bad pets.' triple = rdf.extract(sent) print(triple)

luntan-maker commented 3 years ago

Hello, I managed to get the following to work:

from nlptriples import triples,setup
rdf = triples.RDF_triple() 
sent = f'A dog is an animal. Dogs are good pets. A cat is an animal. Cats are bad pets.'.split('.')
for i in sent[:4]:
    triple = rdf.extract(i, parsed=False) 
    print(triple)