Skip to content

Instantly share code, notes, and snippets.

@donnut
Created April 6, 2016 09:39
Show Gist options
  • Save donnut/352b87edbe4238e076ac72d971d05b76 to your computer and use it in GitHub Desktop.
Save donnut/352b87edbe4238e076ac72d971d05b76 to your computer and use it in GitHub Desktop.
NER
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from pattern.nl import parsetree, parse, split"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"u'Luchtaanvallen/NNS/B-NP/O op/IN/B-PP/B-PNP Den/NNP/B-NP/I-PNP Bosch/NNP/I-NP/I-PNP'"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"parse('Luchtaanvallen op Den Bosch')"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"u\"Luchtaanvallen/NNS/B-NP/O op/IN/B-PP/O '/./O/O s/NNS/B-NP/O Hertogenbosch/NNP/I-NP/O\""
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"parse(\"Luchtaanvallen op 's Hertogenbosch\")"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"u'GROOT-MOEFTI/NN/B-NP/O VAN/NN/I-NP/O JERUSALEM/NN/I-NP/O IN/NN/I-NP/O ITALIE/NN/I-NP/O'"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"parse(\"GROOT-MOEFTI VAN JERUSALEM IN ITALIE\")"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"u'Groot-Moefti/NNP/B-NP/O Van/IN/B-PP/B-PNP Jerusalem/NNP/B-NP/I-PNP in/RP/O/O Italie/NNP/B-NP/O'"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"parse(\"Groot-Moefti Van Jerusalem In Italie\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment