Python LMF library
 All Classes Namespaces Files Functions Variables
component.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 """! @package morphology
4 """
5 
6 class Component():
7  def __init__(self, position=None, lexeme=None):
8  """! @brief Constructor.
9  Component instances are owned by ListOfComponents.
10  @param position The position of the component in the multiword expression.
11  @param targets Related lexeme.
12  @return A Component instance.
13  """
14  self.position = position
15  # Composed LexicalEntry lexeme
16  self.targets = lexeme
17  ## Pointer to an existing LexicalEntry
18  # There is one LexicalEntry pointer by Component instance
19  self.__lexical_entry = None
20 
21  def __del__(self):
22  """! @brief Destructor.
23  """
24  # Decrement the reference count on pointed objects
25  self.__lexical_entry = None
26 
27  def set_lexical_entry(self, lexical_entry):
28  """! @brief Set pointer to the component lexical entry instance. This function can only be called once the full dictionary has been parsed.
29  @param lexical_entry The component LexicalEntry.
30  @return Component instance.
31  """
32  self.__lexical_entry = lexical_entry
33  return self
34 
35  def get_lexical_entry(self):
36  """! @brief Get pointed lexical entry.
37  @return Component private attribute '__lexical_entry'.
38  """
39  return self.__lexical_entry
40 
41  def get_lexeme(self):
42  """! @brief Get component LexicalEntry lexeme.
43  @return Component attribute 'targets'.
44  """
45  return self.targets
__lexical_entry
Pointer to an existing LexicalEntry There is one LexicalEntry pointer by Component instance...
Definition: component.py:19
def get_lexeme
Get component LexicalEntry lexeme.
Definition: component.py:41
def get_lexical_entry
Get pointed lexical entry.
Definition: component.py:35
def set_lexical_entry
Set pointer to the component lexical entry instance.
Definition: component.py:27