From df2d98a1e10968bd17b578f4402d59e83c81927a Mon Sep 17 00:00:00 2001 From: helmutm Date: Fri, 28 Sep 2007 13:53:12 +0000 Subject: [PATCH] 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 --- classifier/README.txt | 9 +++++++++ classifier/base.py | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/classifier/README.txt b/classifier/README.txt index 2407089..5a88272 100644 --- a/classifier/README.txt +++ b/classifier/README.txt @@ -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 diff --git a/classifier/base.py b/classifier/base.py index 014b4ce..8feda3d 100644 --- a/classifier/base.py +++ b/classifier/base.py @@ -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):