Ejemplo n.º 1
0
 def __init__(
     self,
     id,
     title,
     year=None,
     author=None,
     url=None,
     citation_count=None,
     version_count=None,
     citation_url=None,
     version_url=None,
     related_url=None
 ):
     self.id = id
     self.title = title
     from gn import gn
     self.gn = gn(self.title)
     for name in (
         'year',
         'author',
         'url',
         'citation_count',
         'version_count',
         'citation_url',
         'version_url',
         'related_url'
     ):
         if locals()[name] is not None:
             setattr(self, name, locals()[name])
Ejemplo n.º 2
0
 def _select_best(self, articles):
     from gn import gn
     from lcs import lcs
     return min(articles,
                key=lambda art: lcs(self.gn, gn(_em(art['title']))))
Ejemplo n.º 3
0
 def gn(self):
     from gn import gn
     assert hasattr(self, 'title') and self.title
     return gn(_em(self.title))
Ejemplo n.º 4
0
 def gn(self):
     from gn import gn
     assert hasattr(self, 'title') and self.title
     return gn(_em(self.title))
Ejemplo n.º 5
0
 def _select_best(self, articles):
     from gn import gn
     from lcs import lcs
     return min(articles, key=lambda art: lcs(self.gn, gn(_em(art['title']))))