doc
This commit is contained in:
parent
acfd8f7958
commit
63aca3de2c
6 changed files with 108 additions and 17 deletions
|
|
@ -126,4 +126,14 @@
|
|||
TITLE = {{spaCy 2}: Natural language understanding with {B}loom embeddings, convolutional neural networks and incremental parsing},
|
||||
YEAR = {2017},
|
||||
Note = {spaCy excels at large-scale information extraction tasks.}
|
||||
}
|
||||
|
||||
@InProceedings{SciPyProceedings_11,
|
||||
author = {Aric A. Hagberg and Daniel A. Schult and Pieter J. Swart},
|
||||
title = {Exploring Network Structure, Dynamics, and Function using NetworkX},
|
||||
booktitle = {Proceedings of the 7th Python in Science Conference},
|
||||
pages = {11 - 15},
|
||||
address = {Pasadena, CA USA},
|
||||
year = {2008},
|
||||
editor = {Ga\"el Varoquaux and Travis Vaught and Jarrod Millman},
|
||||
}
|
||||
|
|
@ -29,11 +29,24 @@ Wikipedia\footnote{https://www.wikipedia.org/} is primarily an encyclopedia with
|
|||
|
||||
spaCy\cite{spacy2} features neural models for parsing and entity recognition. These models can be trained for \acf{ner} , tagging and parsing. Its official page on usage\footnote {https://v2.spacy.io/usage/} provides in-depth code example for information extraction.
|
||||
|
||||
In figure \ref{fig:dp}, we see a complex sentence's dependency parsing. It has a \acf{nsubj} , connecting \acfp{pobj} with \acfp{adp} and no \acf{dobj}.
|
||||
|
||||
\begin{figure}[htp!]
|
||||
\centering
|
||||
\includesvg[scale=0.16]{dependency-parser.svg}
|
||||
\caption{kuch kar bhai}
|
||||
\label{fig:propn}
|
||||
\caption{Navigating the parse tree and subtrees}
|
||||
\label{fig:dp}
|
||||
\end{figure}
|
||||
|
||||
The \acs{nsubj} "oil", itself do not give a complete meaning. However, upon combining its dependency noun "Motor", which is "Motor oil" gives us an understanding of the topic. Traversing from \acs{nsubj} to \acfp{conj} provides us with three related compound nouns belonging to a similar group.
|
||||
|
||||
"Motor oil", "Engine Oil", "Engine Lubricant"
|
||||
|
||||
Traversing further right of the dependency tree we can extract the \acsp{pobj}. An \acf{amod} "internal" is connecting compound noun "combustion engine".
|
||||
|
||||
\begin{figure}[htp!]
|
||||
\centering
|
||||
\includesvg[scale=0.7]{verbpart.svg}
|
||||
\caption{Negetive Part}
|
||||
\label{fig:vp}
|
||||
\end{figure}
|
||||
|
|
|
|||
58
doc/images/verbpart.svg
Normal file
58
doc/images/verbpart.svg
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en" id="807c0d25dc504bd9abbef9677d14dfd9-0" class="displacy" width="925" height="399.5" direction="ltr" style="max-width: none; height: 399.5px; color: #000000; background: #ffffff; font-family: Arial; direction: ltr">
|
||||
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
|
||||
<tspan class="displacy-word" fill="currentColor" x="50">Ford</tspan>
|
||||
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="50">PROPN</tspan>
|
||||
</text>
|
||||
|
||||
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
|
||||
<tspan class="displacy-word" fill="currentColor" x="225">does</tspan>
|
||||
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="225">AUX</tspan>
|
||||
</text>
|
||||
|
||||
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
|
||||
<tspan class="displacy-word" fill="currentColor" x="400">not</tspan>
|
||||
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="400">PART</tspan>
|
||||
</text>
|
||||
|
||||
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
|
||||
<tspan class="displacy-word" fill="currentColor" x="575">recomend</tspan>
|
||||
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="575">VERB</tspan>
|
||||
</text>
|
||||
|
||||
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
|
||||
<tspan class="displacy-word" fill="currentColor" x="750">Fx01</tspan>
|
||||
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="750">PROPN</tspan>
|
||||
</text>
|
||||
|
||||
<g class="displacy-arrow">
|
||||
<path class="displacy-arc" id="arrow-807c0d25dc504bd9abbef9677d14dfd9-0-0" stroke-width="2px" d="M70,264.5 C70,2.0 575.0,2.0 575.0,264.5" fill="none" stroke="currentColor"/>
|
||||
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
|
||||
<textPath xlink:href="#arrow-807c0d25dc504bd9abbef9677d14dfd9-0-0" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">nsubj</textPath>
|
||||
</text>
|
||||
<path class="displacy-arrowhead" d="M70,266.5 L62,254.5 78,254.5" fill="currentColor"/>
|
||||
</g>
|
||||
|
||||
<g class="displacy-arrow">
|
||||
<path class="displacy-arc" id="arrow-807c0d25dc504bd9abbef9677d14dfd9-0-1" stroke-width="2px" d="M245,264.5 C245,89.5 570.0,89.5 570.0,264.5" fill="none" stroke="currentColor"/>
|
||||
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
|
||||
<textPath xlink:href="#arrow-807c0d25dc504bd9abbef9677d14dfd9-0-1" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">aux</textPath>
|
||||
</text>
|
||||
<path class="displacy-arrowhead" d="M245,266.5 L237,254.5 253,254.5" fill="currentColor"/>
|
||||
</g>
|
||||
|
||||
<g class="displacy-arrow">
|
||||
<path class="displacy-arc" id="arrow-807c0d25dc504bd9abbef9677d14dfd9-0-2" stroke-width="2px" d="M420,264.5 C420,177.0 565.0,177.0 565.0,264.5" fill="none" stroke="currentColor"/>
|
||||
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
|
||||
<textPath xlink:href="#arrow-807c0d25dc504bd9abbef9677d14dfd9-0-2" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">neg</textPath>
|
||||
</text>
|
||||
<path class="displacy-arrowhead" d="M420,266.5 L412,254.5 428,254.5" fill="currentColor"/>
|
||||
</g>
|
||||
|
||||
<g class="displacy-arrow">
|
||||
<path class="displacy-arc" id="arrow-807c0d25dc504bd9abbef9677d14dfd9-0-3" stroke-width="2px" d="M595,264.5 C595,177.0 740.0,177.0 740.0,264.5" fill="none" stroke="currentColor"/>
|
||||
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
|
||||
<textPath xlink:href="#arrow-807c0d25dc504bd9abbef9677d14dfd9-0-3" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">dobj</textPath>
|
||||
</text>
|
||||
<path class="displacy-arrowhead" d="M740.0,266.5 L748.0,254.5 732.0,254.5" fill="currentColor"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
|
|
@ -14,6 +14,11 @@
|
|||
\acro{qg}[QG]{Question generation}
|
||||
|
||||
\acro{ner}[NER]{Named Entity Recognition}
|
||||
|
||||
\acro{adp}[ADP]{adposition}
|
||||
\acro{pobj}[pobj]{prepositional object}
|
||||
\acro{dobj}[dobj]{direct object}
|
||||
\acro{nsubj}[nsubj]{nominal subject}
|
||||
\acro{conj}[conj]{coordinating conjunction}
|
||||
\acro{amod}[amod]{adjectival modifier}
|
||||
\end{acronym}
|
||||
|
||||
|
|
|
|||
0
knowledgegraph/graph.ipynb
Normal file
0
knowledgegraph/graph.ipynb
Normal file
|
|
@ -498,18 +498,25 @@
|
|||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"3855"
|
||||
]
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"text = (\"Ford does not recomend Fx01\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"doc = nlp(text)"
|
||||
"text = (\"Ford does not recomend Fx01\")\n",
|
||||
"doc = nlp(text)\n",
|
||||
"svg = displacy.render(doc, style=\"dep\",jupyter=False)\n",
|
||||
"\n",
|
||||
"output_path = Path(\"../doc/images/verbpart.svg\") # you can keep there only \"dependency_plot.svg\" if you want to save it in the same folder where you run the script \n",
|
||||
"output_path.open(\"w\", encoding=\"utf-8\").write(svg)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -587,9 +594,7 @@
|
|||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"displacy.render(doc, style=\"dep\")"
|
||||
]
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
|
|
|
|||
Loading…
Reference in a new issue