def questionable_test(self): l1 = " b. ?Koja ot tezi knigi se ¤cudi ¤s koj znae koj prodava?" l2 = " b. Koja ot tezi knigi se ¤cudi ¤s koj znae koj prodava?" l3 = "* b. ?Koja ot tezi knigi se ¤cudi ¤s koj znae koj prodava?" l4 = "?* b. Koja ot tezi knigi se ¤cudi ¤s koj znae koj prodava?" self.assertEqual(get_judgment(l1), None) self.assertEqual(get_judgment(l2), None) self.assertEqual(get_judgment(l3), '*') self.assertEqual(get_judgment(l4), '?*')
p.add_argument('-d', '--dest', required=True, help='Output directory for modified files.') p.add_argument('-f', '--force', help='Force overwrite existing files.') args = p.parse_args() for path in args.FILE: with open(path, 'r', encoding='utf-8') as f: xc = xigtxml.load(f, mode=INCREMENTAL) for inst in xc: JUDG_LOG.info('Processing instance "{}"'.format(inst.id)) for item in xigtpath.findall(inst, 'tier[@type='+ODIN_TIER_TYPE+ ']/item'): # Skip blank lines if item.value() is None: continue # Get the judgment and add it if it is non-null. j = get_judgment(item.value()) if j is not None: item.attributes[ODIN_JUDGMENT_ATTRIBUTE] = j JUDG_LOG.debug('Judgment found on item "{}"'.format(item.id)) # Make the output directory if it doesn't exist. makedirs(args.dest, exist_ok=True) outpath = os.path.join(args.dest, os.path.basename(path)) if not os.path.exists(outpath) or args.force: with open(outpath, 'w', encoding='utf-8') as out_f: xigtxml.dump(out_f, xc)
def ungrammatical_test(self): l1 = " *'Read many books, she has'" self.assertEqual(get_judgment(l1), '*')