structs package

Submodules

structs.basecompare module

filename

sppas.src.structs.basecompare.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

Base classes to compare data in the filter system.

class structs.basecompare.sppasBaseCompare[source]

Bases: object

Base class for comparisons.

__init__()[source]

Constructor of a sppasBaseCompare.

get(name)[source]

Return the function of the given name.

Parameters

name – (str) Simple name of a method of this class

get_function_names()[source]

Return the list of comparison functions.

class structs.basecompare.sppasListCompare[source]

Bases: structs.basecompare.sppasBaseCompare

Comparison methods for two lists.

__init__()[source]

Create a new instance.

static leq(elements, x)[source]

Return True if number of elements in the list is equal to x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

static lge(elements, x)[source]

Return True if number of elements in the list is greater or equal than x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

static lgt(elements, x)[source]

Return True if number of elements in the list is greater than x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

static lle(elements, x)[source]

Return True if number of elements in the list is lower or equal than x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

static llt(elements, x)[source]

Return True if number of elements in the list is lower than x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

static lne(elements, x)[source]

Return True if number of elements in the list is not equal to x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

structs.basefilters module

src.structs.basefilters.py

class structs.basefilters.sppasBaseFilters(obj)[source]

Bases: object

Base class for any filter system.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2019 Brigitte Bigi

__init__(obj)[source]

Create a sppasBaseFilters instance.

Parameters

obj – (object) The object to be filtered.

static fix_function_values(comparator, **kwargs)[source]

Return the list of function names and the expected value.

Parameters

comparator – (sppasBaseComparator)

static fix_functions(comparator, **kwargs)[source]

Parse the args to get the list of function/value/complement.

Parameters

comparator – (sppasBaseComparator)

static fix_logic_bool(**kwargs)[source]

Return the value of a logic boolean predicate.

Expect the “logic_bool” argument.

Returns

(str) “and” or “or”. By default, the logical “and” is returned.

Raise

sppasValueError

static fix_logic_bool_label(**kwargs)[source]

Return the value of a logic boolean predicate.

Expect the “logic_bool_label” args.

Returns

(str) “all” or “any”. By default, “any” is returned.

Raise

sppasValueError

static test_args(comparator, **kwargs)[source]

Raise an exception if any of the args is not correct.

Parameters

comparator – (sppasBaseComparator)

structs.basefset module

structs.basefset.py

Base class for the result of any kind of SPPAS filter.

class structs.basefset.sppasBaseSet[source]

Bases: object

Manager for a set of data.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2019 Brigitte Bigi

Mainly used with the data that are the result of the filter system.

A sppasBaseSet() manages a dictionary with:

  • key: an object

  • value: a list of strings

It implements the operators ‘|’ and ‘&’.

__init__()[source]

Create a sppasBaseSet instance.

append(data, value)[source]

Append a data in the data set, with the given value.

Parameters
  • data – (object)

  • value – (list of str) List of any string.

copy()[source]

Make a deep copy of self.

get_value(data)[source]

Return the string value corresponding to a data.

Parameters

data – (object)

Returns

(list of str) the string value to associate to the data.

remove(data)[source]

Remove the data of the data set.

Parameters

data – (object)

structs.baseoption module

structs.baseoption.py

class structs.baseoption.sppasBaseOption(option_type, option_value='')[source]

Bases: object

Class to deal with one option.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2019 Brigitte Bigi

In many situations, we have to store an un-typed data and its type separately, plus eventually other information like a description. Such data is called “option”.

An option is a set of data with a main value and its type, plus 3 other variables to store any kind of information. By default, the type of an option is “str”, the value is an empty string and the name, text and description are all empty strings.

>>> o = sppasBaseOption("integer", "3")
>>> v = o.get_value()
>>> type(v)
>>> <type 'int'>
>>> v = o.get_untypedvalue()
>>> type(v)
>>> <type 'str'>
__init__(option_type, option_value='')[source]

Create a sppasBaseOption instance.

The type of an option is one of the key of type_mapping (i.e. ‘int’, ‘bool’, ‘float’, …). Notice that the type will be normalized. For example, ‘int, ‘integer’, ‘long or ‘short’ will be all stored into ‘int’ type.

Parameters
  • option_type – (str) Type of the option.

  • option_value – (str) Value of the option.

get_description()[source]

Return the long text which describes the option.

get_name()[source]

Return the name of to this option.

get_text()[source]

Return the brief text which describes the option.

get_type()[source]

Return the type of the option.

Returns

normalized value of the type

get_untypedvalue()[source]

Return the value as it was given.

i.e. without taking the given type into account.

get_value()[source]

Return the typed-value or None if the type is unknown.

set(other)[source]

Set self from another instance.

Parameters

other – (sppasBaseOption) The option from which to get info.

set_description(description)[source]

Set a long text to describe the option.

Parameters

description – (str) Option description.

set_name(name)[source]

Set a name to describe the option.

Parameters

name – (str) Option description.

set_text(text)[source]

Set a brief text to describe the option.

Parameters

text – (str) Option description.

set_type(option_type)[source]

Set a new type.

Possible types are: ‘int’, ‘bool’, ‘float’, ‘str’. If the given type is not valid, it will be set to ‘str’.

Parameters

option_type – (str) Type of the option

Returns

True if option_type is valid and set.

set_value(value)[source]

Set a new value.

Parameters

value – (any type) Un-typed value of the option.

type_mappings = {'bool': <function sppasBaseOption.<lambda>>, 'file': <class 'str'>, 'float': <class 'float'>, 'int': <class 'int'>, 'str': <class 'str'>}
class structs.baseoption.sppasOption(option_key, option_type='str', option_value='')[source]

Bases: structs.baseoption.sppasBaseOption

Adds a key to a sppasBaseOption.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2019 Brigitte Bigi

__init__(option_key, option_type='str', option_value='')[source]

Create a sppasOption instance.

Parameters
  • option_key – (any type) An identifier for that option.

  • option_type – (str) Type of the option.

  • option_value – (str) The value of the option.

get_key()[source]

Return the key of that option.

structs.dag module

annotations.dag.py

class structs.dag.DAG[source]

Bases: object

Direct Acyclic Graph.

Implementation inspired from: http://www.python.org/doc/essays/graphs/

property Graph
__init__()[source]

Create a new DAG instance.

This class represents the DAG as a dictionary. For example:

  • A -> B

  • A -> C

  • B -> C

  • B -> D

  • C -> D

will be represented as: {‘A’: [‘B’, ‘C’], ‘B’: [‘C’, ‘D’], ‘C’: [‘D’],}

add_edge(src, dst)[source]

Add a new edge to a node.

add_node(node)[source]

Add a new node (not added if already in the DAG).

find_all_paths(start, end, path=[])[source]
find_path(start, end, path=[])[source]

Determine a path between two nodes.

It takes a graph and the start and end nodes as arguments. It will return a list of nodes (including the start and end nodes) comprising the path. When no path can be found, it returns None. Note: The same node will not occur more than once on the path returned (i.e. it won’t contain cycles).

>>> find_path(graph, 'A', 'C')
>>> ['A', 'B', 'C']
find_shortest_path(start, end, path=[])[source]
remove_edge(src, dst)[source]
remove_node(node)[source]

Remove a node.

structs.lang module

structs.lang.py

class structs.lang.sppasLangResource[source]

Bases: object

Manage information of a resource for a language.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2018 Brigitte Bigi

In most of the automatic annotations, we have to deal with language resources. Here, we store information about the type of resources, the path to get them, etc.

RESOURCES_TYPES = ['file', 'directory']
__init__()[source]

Create a sppasLangResource instance.

get_lang()[source]

Return the language name.

Language names in SPPAS are commonly represented in iso-639-3. It is a code that aims to define three-letter identifiers for all known human languages. “und” is representing an undetermined language. See <http://www-01.sil.org/iso639-3/> for details…

Returns

(str) Language code or an empty string if no lang was set.

get_langlist()[source]

Return the list of available languages.

Returns

List of str

get_langresource()[source]

Return the resource name defined for the given language.

get_resourceext()[source]

Return the language extension.

get_resourcetype()[source]

Return the language type.

is_lang_resource()[source]

Return False if the given resource is not representing a language.

reset()[source]

Set all members to their default value.

set(rtype, rpath, rname='', rext='', rlang=True)[source]

Set resources then fix the list of available languages.

Parameters
  • rtype – (str) Resource type. One of: “file” or “directory”

  • rpath – (str) Resource path

  • rname – (str) Resource file name

  • rext – (str) Resource extension

  • rlang – (bool) Language-dependent resource

set_extension(resource_extension)[source]

Fix the language resource file extension.

Parameters

resource_extension – (str) Resource filename extension.

set_filename(resource_filename)[source]

Fix the language resource filename.

Parameters

resource_filename – (str) Resource filename.

set_lang(lang)[source]

Set the language.

To reset the language, fix lang to None.

Parameters

lang – (str) The language must be either UNDETERMINED

or one of the language of the list.

set_path(resource_path)[source]

Fix the language resource path.

Parameters

resource_path – (str) Relative path to find the resource.

set_type(resource_type)[source]

Set the type of the resource.

Parameters

resource_type – (str) One of “file” or “directory”.

structs.metainfo module

structs.metainfo.py

class structs.metainfo.sppasMetaInfo[source]

Bases: object

Meta information manager.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2019 Brigitte Bigi

Meta-information is a sorted collection of pairs (key, value) where value is a tuple with first argument of type boolean to indicate the state of the key: enabled/disabled.

Manage meta information of type (key,value). Allows to enable/disable each one. Keys are unicode strings, and values can be of any type.

>>> m = sppasMetaInfo()
>>> m.add_metainfo('author', 'Brigitte Bigi')
>>> m.add_metainfo('version', (1,8,2))
__init__()[source]

Create a new sppasMetaInfo instance.

add_metainfo(key, strv)[source]

Fix a meta information or update it.

Parameters
  • key – (str) The key of the meta-information

  • strv – (str)

enable_metainfo(key, value=True)[source]

Enable/Disable a meta information.

Parameters
  • key – (str) The key of the meta-information

  • value – (bool) Status of the meta-information

Raises

MetaKeyError

get_metainfo(key)[source]

Return the value of a given key.

Parameters

key – (str) The key of the meta-information

Raises

MetaKeyError

is_enable_metainfo(key)[source]

Return the status of a given key.

Parameters

key – (str) The key of the meta-information

Raises

MetaKeyError

keys_enabled()[source]

Return a list of the keys of enabled meta information.

Returns

list of unicode strings

pop_metainfo(key)[source]

Pop a meta information.

Parameters

key – (str) The key of the meta-information

Raises

MetaKeyError

structs.structsexc module

structs.structsexc.py

exception structs.structsexc.LangNameError(lang)[source]

Bases: ValueError

:ERROR 6028:.

The language must be “und” or one of the language list. Unknown language {lang}.

__init__(lang)[source]
exception structs.structsexc.LangPathError(folder)[source]

Bases: TypeError

:ERROR 6024:.

The resource folder {dirname} does not exists.

__init__(folder)[source]
exception structs.structsexc.LangTypeError(lang_type)[source]

Bases: TypeError

:ERROR 6020:.

Unknown resource type: expected file or directory. Got: {string}.

__init__(lang_type)[source]
exception structs.structsexc.MetaKeyError(key)[source]

Bases: KeyError

:ERROR 6010:.

{meta} is not a known meta information.

__init__(key)[source]

structs.tips module

ui.tips.py

class structs.tips.sppasTips[source]

Bases: object

Manage a set of tips.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2018 Brigitte Bigi

Tips is a set of short help messages that a software tool can display when it’s starting. Some users find them useful…

Tips are stored into a file with name TIPS_FILE. This file format is with one tip a line.

>>> t = sppasTips()
>>> print(t.get_message())
__init__()[source]

Create a sppasTips instance.

Load the list of message tips of the software.

add_message(message)[source]

Add a new message tips in the list of tips.

Parameters

message – (str) A help message.

get_message()[source]

Return a random tips message.

Returns

unicode

load_tips(filename=None)[source]

Load message tips from a file.

Update the existing tips of the list (if any).

Parameters

filename – (str) Name of the file to get message tips.

save_tips(filename=None)[source]

Save tips in a file.

Parameters

filename – (str) Name of the file to store message tips.

Module contents

filename

sppas.src.structs.__init__.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

Package for the data structures of SPPAS.

structs: access and manage data structures.

This package includes classes to manage data like un-typed options, a language, a dag…

Requires the following other packages:

  • config

  • utils

class structs.sppasBaseCompare[source]

Bases: object

Base class for comparisons.

__init__()[source]

Constructor of a sppasBaseCompare.

get(name)[source]

Return the function of the given name.

Parameters

name – (str) Simple name of a method of this class

get_function_names()[source]

Return the list of comparison functions.

class structs.sppasBaseFilters(obj)[source]

Bases: object

Base class for any filter system.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2019 Brigitte Bigi

__init__(obj)[source]

Create a sppasBaseFilters instance.

Parameters

obj – (object) The object to be filtered.

static fix_function_values(comparator, **kwargs)[source]

Return the list of function names and the expected value.

Parameters

comparator – (sppasBaseComparator)

static fix_functions(comparator, **kwargs)[source]

Parse the args to get the list of function/value/complement.

Parameters

comparator – (sppasBaseComparator)

static fix_logic_bool(**kwargs)[source]

Return the value of a logic boolean predicate.

Expect the “logic_bool” argument.

Returns

(str) “and” or “or”. By default, the logical “and” is returned.

Raise

sppasValueError

static fix_logic_bool_label(**kwargs)[source]

Return the value of a logic boolean predicate.

Expect the “logic_bool_label” args.

Returns

(str) “all” or “any”. By default, “any” is returned.

Raise

sppasValueError

static test_args(comparator, **kwargs)[source]

Raise an exception if any of the args is not correct.

Parameters

comparator – (sppasBaseComparator)

class structs.sppasBaseOption(option_type, option_value='')[source]

Bases: object

Class to deal with one option.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2019 Brigitte Bigi

In many situations, we have to store an un-typed data and its type separately, plus eventually other information like a description. Such data is called “option”.

An option is a set of data with a main value and its type, plus 3 other variables to store any kind of information. By default, the type of an option is “str”, the value is an empty string and the name, text and description are all empty strings.

>>> o = sppasBaseOption("integer", "3")
>>> v = o.get_value()
>>> type(v)
>>> <type 'int'>
>>> v = o.get_untypedvalue()
>>> type(v)
>>> <type 'str'>
__init__(option_type, option_value='')[source]

Create a sppasBaseOption instance.

The type of an option is one of the key of type_mapping (i.e. ‘int’, ‘bool’, ‘float’, …). Notice that the type will be normalized. For example, ‘int, ‘integer’, ‘long or ‘short’ will be all stored into ‘int’ type.

Parameters
  • option_type – (str) Type of the option.

  • option_value – (str) Value of the option.

get_description()[source]

Return the long text which describes the option.

get_name()[source]

Return the name of to this option.

get_text()[source]

Return the brief text which describes the option.

get_type()[source]

Return the type of the option.

Returns

normalized value of the type

get_untypedvalue()[source]

Return the value as it was given.

i.e. without taking the given type into account.

get_value()[source]

Return the typed-value or None if the type is unknown.

set(other)[source]

Set self from another instance.

Parameters

other – (sppasBaseOption) The option from which to get info.

set_description(description)[source]

Set a long text to describe the option.

Parameters

description – (str) Option description.

set_name(name)[source]

Set a name to describe the option.

Parameters

name – (str) Option description.

set_text(text)[source]

Set a brief text to describe the option.

Parameters

text – (str) Option description.

set_type(option_type)[source]

Set a new type.

Possible types are: ‘int’, ‘bool’, ‘float’, ‘str’. If the given type is not valid, it will be set to ‘str’.

Parameters

option_type – (str) Type of the option

Returns

True if option_type is valid and set.

set_value(value)[source]

Set a new value.

Parameters

value – (any type) Un-typed value of the option.

type_mappings = {'bool': <function sppasBaseOption.<lambda>>, 'file': <class 'str'>, 'float': <class 'float'>, 'int': <class 'int'>, 'str': <class 'str'>}
class structs.sppasBaseSet[source]

Bases: object

Manager for a set of data.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2019 Brigitte Bigi

Mainly used with the data that are the result of the filter system.

A sppasBaseSet() manages a dictionary with:

  • key: an object

  • value: a list of strings

It implements the operators ‘|’ and ‘&’.

__init__()[source]

Create a sppasBaseSet instance.

append(data, value)[source]

Append a data in the data set, with the given value.

Parameters
  • data – (object)

  • value – (list of str) List of any string.

copy()[source]

Make a deep copy of self.

get_value(data)[source]

Return the string value corresponding to a data.

Parameters

data – (object)

Returns

(list of str) the string value to associate to the data.

remove(data)[source]

Remove the data of the data set.

Parameters

data – (object)

class structs.sppasLangResource[source]

Bases: object

Manage information of a resource for a language.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2018 Brigitte Bigi

In most of the automatic annotations, we have to deal with language resources. Here, we store information about the type of resources, the path to get them, etc.

RESOURCES_TYPES = ['file', 'directory']
__init__()[source]

Create a sppasLangResource instance.

get_lang()[source]

Return the language name.

Language names in SPPAS are commonly represented in iso-639-3. It is a code that aims to define three-letter identifiers for all known human languages. “und” is representing an undetermined language. See <http://www-01.sil.org/iso639-3/> for details…

Returns

(str) Language code or an empty string if no lang was set.

get_langlist()[source]

Return the list of available languages.

Returns

List of str

get_langresource()[source]

Return the resource name defined for the given language.

get_resourceext()[source]

Return the language extension.

get_resourcetype()[source]

Return the language type.

is_lang_resource()[source]

Return False if the given resource is not representing a language.

reset()[source]

Set all members to their default value.

set(rtype, rpath, rname='', rext='', rlang=True)[source]

Set resources then fix the list of available languages.

Parameters
  • rtype – (str) Resource type. One of: “file” or “directory”

  • rpath – (str) Resource path

  • rname – (str) Resource file name

  • rext – (str) Resource extension

  • rlang – (bool) Language-dependent resource

set_extension(resource_extension)[source]

Fix the language resource file extension.

Parameters

resource_extension – (str) Resource filename extension.

set_filename(resource_filename)[source]

Fix the language resource filename.

Parameters

resource_filename – (str) Resource filename.

set_lang(lang)[source]

Set the language.

To reset the language, fix lang to None.

Parameters

lang – (str) The language must be either UNDETERMINED

or one of the language of the list.

set_path(resource_path)[source]

Fix the language resource path.

Parameters

resource_path – (str) Relative path to find the resource.

set_type(resource_type)[source]

Set the type of the resource.

Parameters

resource_type – (str) One of “file” or “directory”.

class structs.sppasListCompare[source]

Bases: structs.basecompare.sppasBaseCompare

Comparison methods for two lists.

__init__()[source]

Create a new instance.

static leq(elements, x)[source]

Return True if number of elements in the list is equal to x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

static lge(elements, x)[source]

Return True if number of elements in the list is greater or equal than x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

static lgt(elements, x)[source]

Return True if number of elements in the list is greater than x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

static lle(elements, x)[source]

Return True if number of elements in the list is lower or equal than x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

static llt(elements, x)[source]

Return True if number of elements in the list is lower than x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

static lne(elements, x)[source]

Return True if number of elements in the list is not equal to x.

Parameters
  • elements – (list)

  • x – (int)

Returns

(bool)

class structs.sppasMetaInfo[source]

Bases: object

Meta information manager.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2019 Brigitte Bigi

Meta-information is a sorted collection of pairs (key, value) where value is a tuple with first argument of type boolean to indicate the state of the key: enabled/disabled.

Manage meta information of type (key,value). Allows to enable/disable each one. Keys are unicode strings, and values can be of any type.

>>> m = sppasMetaInfo()
>>> m.add_metainfo('author', 'Brigitte Bigi')
>>> m.add_metainfo('version', (1,8,2))
__init__()[source]

Create a new sppasMetaInfo instance.

add_metainfo(key, strv)[source]

Fix a meta information or update it.

Parameters
  • key – (str) The key of the meta-information

  • strv – (str)

enable_metainfo(key, value=True)[source]

Enable/Disable a meta information.

Parameters
  • key – (str) The key of the meta-information

  • value – (bool) Status of the meta-information

Raises

MetaKeyError

get_metainfo(key)[source]

Return the value of a given key.

Parameters

key – (str) The key of the meta-information

Raises

MetaKeyError

is_enable_metainfo(key)[source]

Return the status of a given key.

Parameters

key – (str) The key of the meta-information

Raises

MetaKeyError

keys_enabled()[source]

Return a list of the keys of enabled meta information.

Returns

list of unicode strings

pop_metainfo(key)[source]

Pop a meta information.

Parameters

key – (str) The key of the meta-information

Raises

MetaKeyError

class structs.sppasOption(option_key, option_type='str', option_value='')[source]

Bases: structs.baseoption.sppasBaseOption

Adds a key to a sppasBaseOption.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2019 Brigitte Bigi

__init__(option_key, option_type='str', option_value='')[source]

Create a sppasOption instance.

Parameters
  • option_key – (any type) An identifier for that option.

  • option_type – (str) Type of the option.

  • option_value – (str) The value of the option.

get_key()[source]

Return the key of that option.

class structs.sppasTips[source]

Bases: object

Manage a set of tips.

Author

Brigitte Bigi

Organization

Laboratoire Parole et Langage, Aix-en-Provence, France

Contact

develop@sppas.org

License

GPL, v3

Copyright

Copyright (C) 2011-2018 Brigitte Bigi

Tips is a set of short help messages that a software tool can display when it’s starting. Some users find them useful…

Tips are stored into a file with name TIPS_FILE. This file format is with one tip a line.

>>> t = sppasTips()
>>> print(t.get_message())
__init__()[source]

Create a sppasTips instance.

Load the list of message tips of the software.

add_message(message)[source]

Add a new message tips in the list of tips.

Parameters

message – (str) A help message.

get_message()[source]

Return a random tips message.

Returns

unicode

load_tips(filename=None)[source]

Load message tips from a file.

Update the existing tips of the list (if any).

Parameters

filename – (str) Name of the file to get message tips.

save_tips(filename=None)[source]

Save tips in a file.

Parameters

filename – (str) Name of the file to store message tips.