Bonsoir,

Je veux extraire des données à partir d'un fichier XML puis appliquer TextRazor sur les données extraites.

Voilà mon code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from lxml import etree
import textrazor
tree = etree.parse("wordlist.xml")
c=' '
for user in tree.xpath("/item/str",encoding="utf-8"):
    c += user.text
print(c + '\n')
textrazor.api_key = "5522666"
client = textrazor.TextRazor(extractors=["word","entities", "topics","sentence","words"])
response = client.analyze(c)
def calcul(response):
    cmd = ''
    for entity in response.entities():
            print(entity.id, entity.relevance_score, entity.confidence_score, entity.freebase_types)
            cmd += str(entity.id) + str(entity.relevance_score) + str(entity.confidence_score) + str(entity.freebase_types) + '\n'
    return str(cmd)
print(calcul(response))
Mais le code ne fonctionne pas, l'erreur suivante s'affiche:

TextRazorAnalysisException: TextRazor returned HTTP Code 400: b'{"time":0,"error":"TextRazor cannot analyze documents of language: ind . If you know the language of your documents beforehand, consider setting the \'languageOverride\' paramater. ","ok":false}'
Quelqu'un peut m'aider s'il vous plaît et merci d'avance.