| 55,14 → 55,24 |
| return cmp_to_key(sort_dict_alnum_vulcan) |
| |
| class VulcanDictionary (Dictionary): |
| """ |
| |
| """ |
| def translate (self, phrase, search_prefix=True, search_plural=True): |
| dictionary = self |
| |
| """ |
| |
| :param phrase: |
| :type phrase: |
| :param search_prefix: |
| :type search_prefix: |
| :param search_plural: |
| :type search_plural: |
| """ |
| translation = super().translate(phrase) |
| if translation is not None: |
| return translation |
| else: |
| expr_translation = dictionary.translate_expression(phrase) |
| expr_translation = self.translate_expression(phrase) |
| if expr_translation is not None: |
| return expr_translation |
| |
| 90,6 → 100,17 |
| |
| return None |
| |
| def clean_entry(self, phrase): |
| """ |
| Replace GV Media Script parens with FSE parens |
| :param phrase: |
| :type phrase: |
| """ |
| return sub( |
| r'(\([^)]*\))|\|([^|)]+)\|', |
| lambda m: '({0})'.format(m.group(2)) if m.group(2) else m.group(1), |
| phrase) |
| |
| if __name__ == '__main__': |
| if len(argv) < 2: |
| print('Nothing to translate.', end='\n\n', file=stderr) |
| 157,4 → 178,5 |
| else word, |
| words)), |
| min_level=2) |
| # dmsg(dictionary._expressions) |
| # for key, value in dictionary._expressions.items(): |
| # dmsg(key, value, min_level=3) |