Я использую Textrazor и хочу выяснить предложение, из которого определены ключевые слова, что я не могу.Документация не содержит много информации об этом и нигде не найдена в Интернете.
Как извлечь предложение, относящееся к указанному ключевому слову.
import textrazor
key = "key"
textrazor.api_key = key
client = textrazor.TextRazor(extractors=["word","entities", "topics","sentence","words"])
for entity,sentence in zip(response.entities(),response.sentences()):
print(sentence.words)
Оператор print приводит к словам в предложении, но в формате класса textRazor и не интерпретируется python.
Вывод выглядит следующим образом:
[TextRazor Word:"b'If'" at position 196, TextRazor Word:"b'aggression'" at position 197, TextRazor Word:"b'helps'" at position 198, TextRazor Word:"b'in'" at position 199, TextRazor Word:"b'the'" at position 200, TextRazor Word:"b'survival'" at position 201, TextRazor Word:"b'of'" at position 202, TextRazor Word:"b'our'" at position 203, TextRazor Word:"b'genes'" at position 204, TextRazor Word:"b','" at position 205, TextRazor Word:"b'then'" at position 206, TextRazor Word:"b'the'" at position 207, TextRazor Word:"b'process'" at position 208, TextRazor Word:"b'of'" at position 209, TextRazor Word:"b'natural'" at position 210, TextRazor Word:"b'selection'" at position 211, TextRazor Word:"b'may'" at position 212, TextRazor Word:"b'well'" at position 213, TextRazor Word:"b'have'" at position 214, TextRazor Word:"b'caused'" at position 215, TextRazor Word:"b'humans'" at position 216, TextRazor Word:"b','" at position 217, TextRazor Word:"b'as'" at position 218, TextRazor Word:"b'it'" at position 219, TextRazor Word:"b'would'" at position 220, TextRazor Word:"b'any'" at position 221, TextRazor Word:"b'other'" at position 222, TextRazor Word:"b'animal'" at position 223, TextRazor Word:"b','" at position 224, TextRazor Word:"b'to'" at position 225, TextRazor Word:"b'be'" at position 226, TextRazor Word:"b'aggressive'" at position 227, TextRazor Word:"b'-LRB-'" at position 228, TextRazor Word:"b'Buss'" at position 229, TextRazor Word:"b'&'" at position 230, TextRazor Word:"b'Duntley'" at position 231, TextRazor Word:"b','" at position 232, TextRazor Word:"b'2006'" at position 233, TextRazor Word:"b'-RRB-'" at position 234, TextRazor Word:"b'.'" at position 235]