moe.encoder module

The daemon module contains all the logic required for the encoding/decoding of any cypher code.

class moe.encoder.Encoder(file, default_space=' ', default_separator='¶', default_value='⁜')[source]

Bases: object

Encodes and decodes text from a given dictionnary passed through CSV.

Parameters:
  • file (str) – The csv file containing the encoding: LETTER, CODE. It can have an entry for default space called SPACE. i.e. the characte to separate encoded words It can have an entry for default separator called SEPARATOR. i.e. the character to separate encoded letters It can have an entry for default non supported values called DEFAULT.
  • default_space (str, optional) – Defaults to ‘ ‘. If no default space is present in the CSV file, it can be passed here.
  • default_separator (str, optional) – Defaults to ‘¶’. If no default space is present in the CSV file, it can be passed here.
  • default_value (str, optional) – Defaults to ‘⁜’. If no default value is present in the CSV file, it can be passed here.
decode(coded_string)[source]

Decode a given coded string.

Parameters:coded_string (str) – The string to be decoded.
Returns:The string containing the equivalent text.
Return type:str
encode(text)[source]

Encode a given text with the configured dictionnary.

Parameters:text (str) – The text to be encoded.
Returns:The encoded string.
Return type:str