1 # This Python file uses the following encoding: utf-8
3 Created on Apr 29, 2011
10 class framework(object):
14 CONCEPT_HIERARCHIES
="concept_hierarchies"
20 def _do_step(self
, step
):
21 return step
in self
.__do
_steps
23 def write_state(self
, state
, filename
):
24 with
open(filename
, 'w') as fh
:
25 fh
.write(yaml
.dump(state
))
27 def read_state(self
, filename
):
28 with
open(filename
, 'w') as fh
:
29 return yaml
.load(fh
.read())
31 def process(self
, only_do
=None, **additional_state
):
32 state
= self
._get
_initial
_state
(**additional_state
)
34 if self
._do
_step
(framework
.TERMS
) and not (only_do
and not framework
.TERMS
in only_do
):
35 state
[framework
.TERMS
] = self
._get
_terms
(**state
)
37 if self
._do
_step
(framework
.SYNONYMS
) and not (only_do
and not framework
.SYNONYMS
in only_do
):
38 state
[framework
.SYNONYMS
] = self
._get
_synonyms
(**state
)
40 if self
._do
_step
(framework
.CONCEPTS
) and not (only_do
and not framework
.CONCEPTS
in only_do
):
41 state
[framework
.CONCEPTS
] = self
._get
_concepts
(**state
)
43 if self
._do
_step
(framework
.CONCEPT_HIERARCHIES
) and not (only_do
and not framework
.CONCEPT_HIERARCHIES
in only_do
):
44 state
[framework
.CONCEPT_HIERARCHIES
] = self
._get
_concept
_hierarchies
(**state
)
46 if self
._do
_step
(framework
.RELATIONS
) and not (only_do
and not framework
.RELATIONS
in only_do
):
47 state
[framework
.RELATIONS
] = self
._get
_relations
(**state
)
52 def _get_terms(self
, **state
):
55 class synonyms(object):
56 def _get_synonyms(self
, **state
):
59 class concepts(object):
60 def _get_concepts(self
, **state
):
63 def concept_hierarchies(object):
64 def _get_concept_hierarchies(self
, **state
):
67 def relations(object):
68 def _get_relations(self
, **state
):