Go back to the English version of the documentation概念抽取块
概念抽取块
Last updated: 2024年7月29日
Watson Natural Language Processing Concepts 块会抽取一般 DBPedia 概念 (从特定于语言的维基百科版本中抽取的概念) ,这些概念在输入文本中直接引用或间接引用但未直接引用。
块名
concepts_alchemy_<language>_stock
受支持的语言
"概念" 块可用于以下语言。 有关语言代码和相应语言的列表,请参阅 语言代码。
de , en , es , fr , it , ja , ko , pt
功能
使用此块可从 DBPedia (2016 版) 分配概念。 输出类型基于 DBPedia。
对其他块的依赖关系
必须先运行以下块,然后才能运行 Concepts 抽取块:
syntax_izumo_<language>_stock
代码样本
import watson_nlp
# Load Syntax and a Concepts model for English
syntax_model = watson_nlp.load('syntax_izumo_en_stock')
concepts_model = watson_nlp.load('concepts_alchemy_en_stock')
# Run the syntax model on the input text
syntax_prediction = syntax_model.run('IBM announced new advances in quantum computing')
# Run the concepts model on the result of syntax
concepts = concepts_model.run(syntax_prediction)
print(concepts)
代码示例的输出:
{
"concepts": [
{
"text": "IBM",
"relevance": 0.9842190146446228,
"dbpedia_resource": "http://dbpedia.org/resource/IBM"
},
{
"text": "Quantum_computing",
"relevance": 0.9797260165214539,
"dbpedia_resource": "http://dbpedia.org/resource/Quantum_computing"
},
{
"text": "Computing",
"relevance": 0.9080164432525635,
"dbpedia_resource": "http://dbpedia.org/resource/Computing"
},
{
"text": "Shor's_algorithm",
"relevance": 0.7580527067184448,
"dbpedia_resource": "http://dbpedia.org/resource/Shor's_algorithm"
},
{
"text": "Quantum_dot",
"relevance": 0.7069802284240723,
"dbpedia_resource": "http://dbpedia.org/resource/Quantum_dot"
},
{
"text": "Quantum_algorithm",
"relevance": 0.7063655853271484,
"dbpedia_resource": "http://dbpedia.org/resource/Quantum_algorithm"
},
{
"text": "Qubit",
"relevance": 0.7063655853271484,
"dbpedia_resource": "http://dbpedia.org/resource/Qubit"
},
{
"text": "DNA_computing",
"relevance": 0.7044616341590881,
"dbpedia_resource": "http://dbpedia.org/resource/DNA_computing"
},
{
"text": "Computation",
"relevance": 0.7044616341590881,
"dbpedia_resource": "http://dbpedia.org/resource/Computation"
},
{
"text": "Computer",
"relevance": 0.7044616341590881,
"dbpedia_resource": "http://dbpedia.org/resource/Computer"
}
],
"producer_id": {
"name": "Alchemy Concepts",
"version": "0.0.1"
}
}