Apertium

Write a function that finds features that occur between two given features

We're thinking of making a module for inducing Constraint Grammar rules. One type of constraint grammar rules are barrier rules. As part of inducing barrier rules we need information about what features occur between two features. Your task is to create a function that returns a set of sets that consist of features occuring between the two given features.

Function inputs:

  • a list of feature sequences, e.g., [['n', 'cnjcoo', 'n'], ['vblex', 'cnjcoo', 'part' 'n'], ['vblex', 'adj', 'det' 'n']]
  • starting feature (e.g. vblex)
  • ending feature (e.g. n)

Output: a python set with the found feature sets (the inner sets needs to be frozensets because in python a normal set cannot be inside another set). So if we take the given input examples the output would be something like {{'cnjcoo', 'part'}, {'adj', 'det'} }

For more info about the final goal with generating barrier rules check out section 4.3 of Inducing Constraint Grammars.

Please see our getting started guide for more info.

Task tags

  • constraint grammar
  • python
  • cg

Students who completed this task

nuboro

Task type

  • code Code
close

2016