Exemple #1
0
 def parse(self, log: ProcessLogger, text, text_unit_id, _text_unit_lang, **kwargs) -> ParseResults:
     found = [t.trademark for t in trademarks.get_trademark_annotations(text)]
     if found:
         unique = set(found)
         return ParseResults({TrademarkUsage: [TrademarkUsage(text_unit_id=text_unit_id,
                                                              trademark=item,
                                                              count=found.count(item)
                                                              ) for item in unique]})
Exemple #2
0
    def test_annotation_coords(self):
        text = """...  packages containing the NetLOCK(TM) computer programs in executable
or machine-readable form and written instructional materials.  Licensed Programs
include a NetLOCK(TM)  Manager for network  security  administration  and one or
more  NetLOCK(TM)  Clients for use on multiple  computers  ..."""

        ants = list(get_trademark_annotations(text))
        self.assertEqual(3, len(ants))
        for ant in ants:
            ant_text = text[ant.coords[0]:ant.coords[1]]
            self.assertEqual(ant.trademark.replace(' ', ''),
                             ant_text.replace(' ', ''))
Exemple #3
0
    def test_trademarks(self):
        text = "1.11.SCADA System means a supervisory control and data " + \
               "acquisition system such as the S/3 Software or Licensee's OASyS(R) product."
        ds = list(get_trademarks(text))
        self.assertEqual(1, len(ds))
        self.assertEqual('OASyS (R)', ds[0])

        ants = list(get_trademark_annotations(text))
        self.assertEqual(1, len(ants))
        self.assertEqual('en', ants[0].locale)
        self.assertEqual('OASyS (R)', ants[0].trademark)

        start = text.find('OASyS(R)')
        self.assertGreater(ants[0].coords[1], ants[0].coords[0])
        self.assertEqual((start, ants[0].coords[1]), ants[0].coords)