def root(self): root_phrase = Group(self.specifier_before_cem_and_value_phrase | self.cem_after_specifier_and_value_phrase | self.value_specifier_cem_phrase | self.cem_before_specifier_and_value_phrase | Group(self.specifier_and_value)('root_phrase')) return root_phrase
def list_of_properties(self): """List of specifiers and units""" return Group(Optional(lbrct).hide() + self.single_specifier_and_value_with_optional_unit + (I('and') | delim | (I('that') + I('exhibits'))).hide() + self.single_specifier_and_value + Optional(rbrct).hide())('property_list')
def multi_entity_phrase_4a(self): """multiple compounds, single specifier, single transition e.g. TC of 640 K in BifEO3, LaFeO3 and MnO """ return Group(self.single_specifier_and_value + OneOrMore(Not(self.single_cem | self.specifier_phrase | self.value_phrase) + Any().hide()) + self.list_of_cems)('multi_entity_phrase_4')
def multi_entity_phrase_1(self): """Single compound, multiple specifiers, values e.g. BiFeO3 has TC1 = 1093 K and Tc2 = 640 K """ return Group(self.single_cem + OneOrMore(Not(self.single_cem | self.specifier_phrase | self.value_phrase) + Any().hide()) + self.list_of_properties)('multi_entity_phrase_1')
def multi_entity_phrase_3b(self): """multiple compounds, single specifier, multiple transitions cems last e.g. Tc = 750 and 640 K in LaFeO3 and BiFeO3, respectivel """ return Group(self.prefix + self.list_of_values + Optional(I('in') | I('for')) + self.list_of_cems + Optional(delim + I('respectively')))('multi_entity_phrase_3')
def list_of_cems(self): """List of cems e.g. cem, cem, cem and cem""" return Group(self.single_cem + Optional(lbrct + R('^\d+$') + rbrct).hide() + ZeroOrMore(delim.hide() | self.single_cem | R('^\d+$')) + (I('and') | I('or') | I('to')).hide() + self.single_cem + Optional(lbrct + R('^\d+$') + rbrct).hide() + Optional(I('compounds') | I('samples')))('cem_list')
def multi_entity_phrase_2(self): """single compound, single specifier, multiple transitions e.g. BiFeO3 shows magnetic transitions at 1093 and 640 K """ return Group(self.single_cem + OneOrMore(Not(self.single_cem | self.specifier_phrase | self.value_phrase) + Any().hide()) + self.specifier_phrase + OneOrMore(Not(self.single_cem | self.specifier_phrase | self.value_phrase) + Any().hide()) + self.list_of_values + Optional(delim).hide() + Optional(I('respectively')))('multi_entity_phrase_2')
def multi_entity_phrase_3a(self): """multiple compounds, single specifier, multiple transitions cems first e.g. TC in BiFeO3 and LaFeO3 of 640 and 750 K """ return Group(Optional(self.specifier_phrase) + Optional(I('in') | I('for')).hide() + self.list_of_cems + OneOrMore(Not(self.single_cem | self.specifier_phrase | self.value_phrase) + Any().hide()) + self.prefix + self.list_of_values + Optional(delim.hide() + I('respectively').hide()))('multi_entity_phrase_3')
def multi_entity_phrase_3c(self): """multiple compounds, single specifier, multiple transitions cems last e.g. curie temperatures from 100 K in MnO to 300 K in NiO """ return Group(self.specifier_phrase + self.pure_prefix + self.value_phrase('value1') + (I('for') | I('in') | I('of')) + self.single_cem('cem1') + (Optional(I('up')) + I('to') | I('to')).hide() + self.value_phrase('value2') + (I('for') | I('in') | I('of')) + self.single_cem('cem2'))('multi_entity_phrase_3c')
def multi_entity_phrase_3c(self): """multiple compounds, single specifier, multiple transitions cems last e.g. curie temperatures from 100 K in MnO to 300 K in NiO """ return Group(self.single_specifier_and_value + Optional(I('for') | I('in')).hide() + self.single_cem + (Optional(I('up')) + I('to')).hide() + self.value_phrase + Optional(I('in') | I('for')).hide() + self.single_cem)('multi_entity_phrase_3')
def list_of_values(self): """List of values with either multiple units or one at the end""" # option 1: single unit at the end option_1 = Group(self.value_with_optional_unit + Optional(OneOrMore(delim.hide() + self.value_with_optional_unit)) + Optional(delim).hide() + (I('and') | I('or')).hide() + Optional(delim).hide() + self.value_phrase)('value_list') # option 2: Multiple units option_2 = (self.value_phrase + Optional(OneOrMore(delim.hide() + self.value_phrase)) + Optional(delim).hide() + (I('and') | I('or') | delim).hide() + self.value_phrase)('value_list') return (option_1 | option_2)
def multi_entity_phrase_3(self): """Combined phrases of type 3""" return Group(self.multi_entity_phrase_3a | self.multi_entity_phrase_3b | self.multi_entity_phrase_3c)
def value_and_cem(self): return Group(self.value_phrase + I('in') + self.single_cem)('value_and_cem')
def specifier_and_value(self): return Group(self.prefix + self.value_phrase)
def single_cem(self): """Any cem""" return Group(cem | chemical_label | Group(chemical_name)('compound'))
def unit(self): """Unit element""" return Group(construct_unit_element(self.model.dimensions).with_condition( match_dimensions_of(self.model))('raw_units'))
def multi_entity_phrase_4(self): return Group(self.multi_entity_phrase_4a | self.multi_entity_phrase_4b)
def multi_entity_phrase_4b(self): """Cems first""" return Group(self.list_of_cems + OneOrMore(Not(self.single_cem | self.specifier_phrase | self.value_phrase) + Any().hide()) + self.single_specifier_and_value)('multi_entity_phrase_4')
def single_specifier_and_value_with_optional_unit(self): """Specifier plus value and possible unit""" return Group(self.prefix + self.value_with_optional_unit)('property')
def cem_phrase(self): return Group(cem | chemical_label | Group(chemical_name)('compound'))
def single_specifier_and_value(self): """Specifier value and unit""" return Group(self.prefix + self.value_phrase)('property')