Python LMF library
 All Classes Namespaces Files Functions Variables
list_of_components.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 """! @package morphology
4 """
5 
6 from morphology.component import Component
7 
9  """ "List of Components is a class representing the aggregative aspect of a multiword expression (MWE). The mechanism can also be applied recursively, so that an MWE way be comprised of components that are themselves MWEs. This class is used in the morphological pattern and MWE pattern packages." (LMF)
10  """
11  def __init__(self):
12  """! @brief Constructor.
13  ListOfComponents instance is owned by LexicalEntry.
14  @return A ListOfComponents instance.
15  """
16  ## Component instances are owned by ListOfComponents
17  # There are two or more Component instances per ListOfComponents
18  self.component = [] # ordered list
19 
20  def __del__(self):
21  """! @brief Destructor.
22  Release Component instances.
23  """
24  for component in self.component:
25  del component
26  del self.component[:]
27 
28  def create_and_add_component(self, position, lexeme):
29  """! @brief Create and add a component to the list.
30  @param position The position of the component in the multiword expression.
31  @param lexeme Related lexeme.
32  @return ListOfComponents instance.
33  """
34  self.component.append(Component(position, lexeme))
35  return self
36 
37  def get_components(self):
38  """! @brief Get the list of components.
39  @return ListOfComponents attribute 'component'.
40  """
41  return self.component
def create_and_add_component
Create and add a component to the list.
component
Component instances are owned by ListOfComponents There are two or more Component instances per ListO...