PhraseTypeEntry.py
641 Bytes
#! /usr/bin/python
# -*- coding: utf-8 -*-
from Phrase import phrase_from_tree
from PhraseTypeExpansion import PhraseTypeExpansion
class PhraseTypeEntry:
def __init__(self, entry_tree):
self._type = phrase_from_tree(entry_tree._children[0])
self._expansions = [PhraseTypeExpansion.fromTree(expansion_tree) for expansion_tree in entry_tree._children[1]._children[0]._children]
def write(self, out):
for expansion in self._expansions:
out['expansions'].write(expansion.toUnicode(self._type.toUnicode(None)) + '\n')
def __unicode__(self):
return self._type.toUnicode(None)