Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Neeme Kahusk
eurown
Commits
d4d42762
Commit
d4d42762
authored
Nov 17, 2016
by
Neeme Kahusk
Browse files
Listid vaikimisi None
parent
0c05548f
Changes
2
Hide whitespace changes
Inline
Side-by-side
eurown.py
View file @
d4d42762
...
...
@@ -72,13 +72,13 @@ def format_polaris(level, field, value=None,
class
Synset
(
object
):
def
__init__
(
self
,
number
=
''
,
pos
=
'n'
,
variants
=
None
,
internal_links
=
[]
,
eq_links
=
[]
,
propert
y_values
=
[]
):
internal_links
=
None
,
eq_links
=
None
,
propert
ies
=
None
):
self
.
pos
=
pos
self
.
variants
=
variants
self
.
internal_links
=
internal_links
self
.
eq_links
=
eq_links
self
.
propert
y_valu
es
=
propert
y_values
self
.
variants
=
variants
or
[]
self
.
internal_links
=
internal_links
or
[]
self
.
eq_links
=
eq_links
or
[]
self
.
propert
i
es
=
propert
ies
or
[]
self
.
number
=
number
# if id:
# self.id = '{}-{}'.format(id, self.pos)
...
...
@@ -87,10 +87,7 @@ class Synset(object):
self
.
fieldname
=
'WORD_MEANING'
def
add_variant
(
self
,
variant
):
if
not
self
.
variants
:
self
.
variants
=
[]
self
.
variants
.
append
(
variant
)
def
add_internal_link
(
self
,
internal_link
):
self
.
internal_links
.
append
(
internal_link
)
...
...
@@ -136,6 +133,19 @@ class Synset(object):
return
out
class
Instance
(
Synset
):
def
__init__
(
self
,
number
=
''
,
variants
=
None
,
internal_links
=
None
,
eq_links
=
None
,
property_values
=
None
):
self
.
pos
=
'pn'
self
.
variants
=
variants
or
[]
self
.
internal_links
=
internal_links
or
[]
self
.
eq_links
=
eq_links
or
[]
self
.
property_values
=
property_values
or
[]
self
.
number
=
number
self
.
fieldname
=
'WORD_INSTANCE'
class
Variant
:
def
__init__
(
self
,
lemma
,
sense
,
...
...
eurown_test.ipynb
View file @
d4d42762
...
...
@@ -108,6 +108,31 @@
"print(snset)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"inst = eurown.Instance()\n",
"print(inst)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"aa = eurown.Variant('Aafrika',1)\n",
"inst.add_variant(aa)\n",
"print(inst)"
]
},
{
"cell_type": "code",
"execution_count": null,
...
...
@@ -120,7 +145,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "
IPython (
Python 3
)
",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
...
...
@@ -134,7 +159,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.
3
"
"version": "3.4.
5
"
}
},
"nbformat": 4,
...
...
%% Cell type:markdown id: tags:
# Eurown testing
%% Cell type:code id: tags:
```
python
>>>
import
eurown
>>>
a
=
eurown
.
Synset
(
43
)
>>>
b
=
eurown
.
Variant
(
'loom'
,
1
)
>>>
c
=
eurown
.
Variant
(
'elajas'
,
2
)
>>>
a
.
add_variant
(
b
)
>>>
print
(
a
)
```
%% Cell type:code id: tags:
```
python
>>>
print
(
b
)
```
%% Cell type:code id: tags:
```
python
>>>
print
(
c
)
```
%% Cell type:code id: tags:
```
python
>>>
a
.
add_variant
(
c
)
>>>
print
(
a
)
```
%% Cell type:code id: tags:
```
python
>>>
a
.
variants
[
0
].
gloss
=
"elusorganism, mida tavaliselt iseloomustab
\
vabatahtliku liikumise võime ja närvisüsteemi olemasolu"
>>>
print
(
a
)
```
%% Cell type:code id: tags:
```
python
d
=
eurown
.
Synset
(
44
)
print
(
d
)
```
%% Cell type:code id: tags:
```
python
d
.
add_variant
(
eurown
.
Variant
(
'elusolend'
,
1
))
d
.
add_variant
(
eurown
.
Variant
(
'organism'
,
2
))
d
.
variants
[
0
].
gloss
=
'elusorganism, hrl. inimene v. loom'
print
(
d
)
```
%% Cell type:code id: tags:
```
python
snset
=
eurown
.
Synset
()
print
(
snset
)
```
%% Cell type:code id: tags:
```
python
inst
=
eurown
.
Instance
()
print
(
inst
)
```
%% Cell type:code id: tags:
```
python
aa
=
eurown
.
Variant
(
'Aafrika'
,
1
)
inst
.
add_variant
(
aa
)
print
(
inst
)
```
%% Cell type:code id: tags:
```
python
```
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment