work in progress: loops.classifier, basic functionality now OK
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2075 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
0132b95db8
commit
df2d98a1e1
2 changed files with 13 additions and 1 deletions
|
@ -128,6 +128,15 @@ that may be identified as being candidates for classification.
|
|||
So we are now ready to have the whole stuff run in one call.
|
||||
|
||||
>>> classifier.process(r1)
|
||||
>>> list(sorted([c.title for c in r1.getConcepts()]))
|
||||
[u'Collection One', u'Contract', u'External File', u'Gerald Webb', u'im Editors']
|
||||
|
||||
>>> for name in rnames[1:]:
|
||||
... classifier.process(resources[name])
|
||||
>>> len(webbg.getResources())
|
||||
4
|
||||
>>> len(webbg.getResources((concepts['ownedby'],)))
|
||||
3
|
||||
|
||||
|
||||
Fin de partie
|
||||
|
|
|
@ -57,13 +57,16 @@ class Classifier(AdapterBase):
|
|||
infoSet.update(extractor.extractInformationSet())
|
||||
analyzer = component.getAdapter(self, name=self.analyzer)
|
||||
statements = analyzer.extractStatements(infoSet)
|
||||
defaultPredicate = self.context.getConceptManager().getDefaultPredicate()
|
||||
for statement in statements:
|
||||
if statement.subject is None:
|
||||
statement.subject = resource
|
||||
if statement.predicate is None:
|
||||
statement.predicate = defaultPredicate
|
||||
self.assignConcept(statement)
|
||||
|
||||
def assignConcept(self, statement):
|
||||
pass
|
||||
statement.object.assignResource(statement.subject, statement.predicate)
|
||||
|
||||
|
||||
class Extractor(object):
|
||||
|
|
Loading…
Add table
Reference in a new issue