anndata.ann.annlabel package

Submodules

anndata.ann.annlabel.label module

filename

sppas.src.anndata.annlabel.label.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

Represent one of labels of an annotation.

class anndata.ann.annlabel.label.sppasLabel(tag, score=None)[source]

Bases: object

Represent the content of an annotation.

sppasLabel allows to store a set of sppasTags with their scores. This class is using a list of lists, i.e. a list of pairs (tag, score). This is the best compromise between memory usage, speed and readability.

A label is a list of possible sppasTag(), represented as a UNICODE string. A data type can be associated, as sppasTag() can be ‘int’, ‘float’ or ‘bool’.

__init__(tag, score=None)[source]

Create a new sppasLabel instance.

Parameters
  • tag – (sppasTag or list of sppasTag or None)

  • score – (float or list of float or None)

append(tag, score=None)[source]

Add a sppasTag into the list.

Do not add the tag if this alternative is already inside the list, but add the scores.

Parameters
  • tag – (sppasTag)

  • score – (float)

append_content(content, data_type='str', score=None)[source]

Add a text into the list.

Parameters
  • content – (str)

  • data_type – (str): The type of this text content.

One of: (str, int, float, bool) :param score: (float)

copy()[source]

Return a deep copy of the label.

get_best()[source]

Return the best sppasTag, i.e. the one with the better score.

Returns

(sppasTag or None)

get_score(tag)[source]

Return the score of a tag or None if tag is not in the label.

Parameters

tag – (sppasTag)

Returns

score: (float)

get_type()[source]

Return the type of the tags content.

is_bool()[source]

Return True if tags are of type “bool”.

Return False if no tag is set.

is_float()[source]

Return True if tags are of type “float”.

Return False if no tag is set.

is_int()[source]

Return True if tags are of type “int”.

Return False if no tag is set.

is_point()[source]

Return True if tags are of type “point”.

Return False if no tag is set.

is_string()[source]

Return True if tags are string or unicode.

Return False if no tag is set.

is_tagged()[source]

Return False if no tag is set.

match(tag_functions, logic_bool='and')[source]

Return True if a tag matches all or any of the functions.

Parameters
  • tag_functions – list of (function, value, logical_not)

  • logic_bool – (str) Apply a logical “and” or a logical “or” between the functions.

Returns

(bool)

  • function: a function in python with 2 arguments: tag/value

  • value: the expected value for the tag

  • logical_not: boolean

Example

Search if a tag is exactly matching “R”:

>>> l.match([(exact, "R", False)])
Example

Search if a tag is starting with “p” or starting with “t”:

>>> l.match([(startswith, "p", False),
>>>          (startswith, "t", False), ], logic_bool="or")
remove(tag)[source]

Remove a tag of the list.

Parameters

tag – (sppasTag) the tag to be removed of the list.

serialize(empty='', alt=True)[source]

Convert the label into a string, include or not alternative tags.

@DeprecationWarning Use aioutils.serialize_label() instead.

set_score(tag, score)[source]

Set a score to a given tag.

Parameters
  • tag – (sppasTag)

  • score – (float)

anndata.ann.annlabel.tag module

filename

sppas.src.anndata.annlabel.tag.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

Represent one of tags of a label.

class anndata.ann.annlabel.tag.sppasTag(tag_content, tag_type=None)[source]

Bases: object

Represent one of the possible tags of a label.

A sppasTag is a data content of any type. By default, the type of the data is “str” and the content is empty, but internally the sppasTag stores ‘None’ values because None is 16 bits and an empty string is 37.

A sppasTag() content can be one of the following types:

  1. string/unicode - (str)

  2. integer - (int)

  3. float - (float)

  4. boolean - (bool)

  5. point - (sppasFuzzyPoint)

  6. rect - (sppasFuzzyRect)

Get access to the content with the get_content() method and to the typed content with get_typed_content().

>>> t1 = sppasTag("2")                      # "2" (str)
>>> t2 = sppasTag(2)                        # "2" (str)
>>> t3 = sppasTag(2, tag_type="int")        # 2 (int)
>>> t4 = sppasTag("2", tag_type="int")      # 2 (int)
>>> t5 = sppasTag("2", tag_type="float")    # 2. (float)
>>> t6 = sppasTag("true", tag_type="bool")  # True (bool)
>>> t7 = sppasTag(0, tag_type="bool")       # False (bool)
>>> t8 = sppasTag((27, 32), tag_type="point")  # x=27, y=32 (point)
>>> t9 = sppasTag((27, 32, 320, 200), tag_type="rect")
TAG_TYPES = ('str', 'float', 'int', 'bool', 'point', 'rect')
__init__(tag_content, tag_type=None)[source]

Initialize a new sppasTag instance.

Parameters
  • tag_content – (any) Data content

  • tag_type – (str): The type of this content. One of: (‘str’, ‘int’, ‘float’, ‘bool’, ‘point’, ‘rect’).

‘str’ is the default tag_type.

copy()[source]

Return a deep copy of self.

get_content()[source]

Return an unicode string corresponding to the content.

Also returns a unicode string in case of a list (elements are separated by a whitespace).

Returns

(unicode)

get_type()[source]

Return the type of the tag content.

get_typed_content()[source]

Return the content value, in its appropriate type.

Excepted for strings which are systematically returned as unicode.

is_dummy()[source]

Return True if the tag is a dummy label.

is_empty()[source]

Return True if the tag is an empty string.

is_laugh()[source]

Return True if the tag is a laughing.

is_noise()[source]

Return True if the tag is a noise.

is_pause()[source]

Return True if the tag is a short pause.

is_silence()[source]

Return True if the tag is a silence.

is_speech()[source]

Return True if the tag is not a silence.

set(other)[source]

Set self members from another sppasTag instance.

Parameters

other – (sppasTag)

set_content(tag_content, tag_type=None)[source]

Change content of this sppasTag.

Parameters
  • tag_content – (any) New text content for this sppasTag

  • tag_type – The type of this tag. Default is ‘str’ to represent an unicode string.

Raise

AnnUnkTypeError, AnnDataTypeError

anndata.ann.annlabel.tagcompare module

filename

sppas.src.anndata.annlabel.tagcompare.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

Comparison methods for a tag, used by the filter system.

class anndata.ann.annlabel.tagcompare.sppasTagCompare[source]

Bases: sppas.src.structs.basecompare.sppasBaseCompare

Comparison methods for sppasTag.

Label’tags can be of 3 types in anndata (str, num, bool) so that this class allows to create different comparison methods depending on the type of the tags.

Example

Three different ways to compare a tag content to a given string

>>> tc = sppasTagCompare()
>>> tc.exact(sppasTag("abc"), u("abc"))
>>> tc.methods['exact'](sppasTag("abc"), u("abc"))
>>> tc.get('exact')(sppasTag("abc"), u("abc"))
__init__()[source]

Create a sppasTagCompare instance.

static bool(tag, x)[source]

Return True if boolean value of the tag is equal to boolean x.

Parameters
  • tag – (sppasTag) Tag to compare.

  • x – (bool)

Returns

(bool)

Raises

AnnDataTypeError

static contains(tag, text)[source]

Test if the first text contains the second text.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static endswith(tag, text)[source]

Test if first text ends with the characters of the second text.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static equal(tag, x)[source]

Return True if numerical value of the tag is equal to x.

Parameters
  • tag – (sppasTag) Tag to compare.

  • x – (int, float)

Returns

(bool)

Raises

AnnDataTypeError

static exact(tag, text)[source]

Test if two texts strictly contain the same characters.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static greater(tag, x)[source]

Return True if numerical value of the tag is greater than x.

Parameters
  • tag – (sppasTag) Tag to compare.

  • x – (int, float)

Returns

(bool)

Raises

AnnDataTypeError

static icontains(tag, text)[source]

Case-insensitive contains.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static iendswith(tag, text)[source]

Case-insensitive endswith.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static iexact(tag, text)[source]

Case-insensitive exact.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static istartswith(tag, text)[source]

Case-insensitive startswith.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static lower(tag, x)[source]

Return True if numerical value of the tag is lower than x.

Parameters
  • tag – (sppasTag) Tag to compare.

  • x – (int, float)

Returns

(bool)

Raises

AnnDataTypeError

static regexp(tag, pattern)[source]

test if text matches pattern.

Parameters
  • tag – (sppasTag) Tag to compare.

  • pattern – (unicode) Pattern to search.

Returns

(bool)

Raises

AnnDataTypeError

static startswith(tag, text)[source]

Test if first text starts with the characters of the second text.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

anndata.ann.annlabel.tagtypes module

filename

sppas.src.anndata.annlabel.tagtypes.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

Represent custom types of tags (point/rect)

class anndata.ann.annlabel.tagtypes.sppasFuzzyPoint(coord, radius=None)[source]

Bases: object

Data structure to represent a point (x,y) with a radius (r).

Mainly used to represent a point in an image with a vagueness around the midpoint. The fuzzy point is then representing a rectangle area. The radius is half of the vagueness.

(x,y) |
r . |

|<——> | | | + - - - - - - - - +

Two fuzzy points are equals if their area overlaps.

__init__(coord, radius=None)[source]

Create a sppasFuzzyPoint instance.

The given coordinates of the midpoint can be a tuple of int values or a string representing it.

Parameters
  • coord – (int,int) x,y coords of the midpoint value.

  • radius – (int) the radius around the midpoint.

contains(coord)[source]

Check if the given midpoint is inside the vagueness of self.

Parameters

coord – (tuple) An (x, y) coordinates

copy()[source]

Return a deep copy of self.

get_midpoint()[source]

Return the midpoint coords (x,y).

get_radius()[source]

Return the radius value (float or None).

static parse(str_point)[source]

Return a tuple (x,y) or (x,y,r).

Parameters

str_point – (str) A string representing a fuzzy point.

set(other)[source]

Set self members from another sppasFuzzyPoint instance.

Parameters

other – (sppasFuzzyPoint)

set_midpoint(midpoint)[source]

Set the midpoint value.

Parameters

midpoint – (tuple(int,int), str) the new midpoint coords.

Raise

AnnDataTypeError

set_radius(radius=None)[source]

Fix the radius value, ie. the vagueness of the point.

The midpoint value must be set first.

Parameters

radius – (int, str, None) the radius value

Raise

AnnDataTypeError, AnnDataNegValueError

class anndata.ann.annlabel.tagtypes.sppasFuzzyRect(coord, radius=None)[source]

Bases: object

Data structure to represent an area (x,y,w,h) with a radius (r).

Mainly used to represent a rectangle in an image with a vagueness around the midpoint, which is a rectangle. The radius is half of the vagueness.

__init__(coord, radius=None)[source]

Create a sppasFuzzyRect instance.

The given coordinates of the midpoint can be a tuple of int values or a string representing it.

Parameters
  • coord – (int,int,int,int) x,y,w,h coords of the midpoint value.

  • radius – (int) the radius around the midpoint.

contains(coord)[source]

Check if the given point is inside the vagueness of self.

Parameters

coord – (tuple) An (x, y) coordinates

copy()[source]

Return a deep copy of self.

get_midpoint()[source]

Return the midpoint coords (x,y,w,h).

get_radius()[source]

Return the radius value (float or None).

static parse(str_rect)[source]

Return a tuple (x,y,w,h) or (x,y,w,h,r).

Parameters

str_rect – (str) A string representing a fuzzy rect.

set(other)[source]

Set self members from another sppasFuzzyRect instance.

Parameters

other – (sppasFuzzyRect)

set_midpoint(midpoint)[source]

Set the midpoint value.

Parameters

midpoint – (tuple(int,int,int,int), str) the new midpoint coords.

Raise

AnnDataTypeError

set_radius(radius=None)[source]

Fix the radius value, ie. the vagueness of the point.

The midpoint value must be set first.

Parameters

radius – (int, str, None) the radius value

Raise

AnnDataTypeError, AnnDataNegValueError

Module contents

filename

sppas.src.anndata.annlabel.__init__.py

author

Brigitte Bigi

contact

develop@sppas.org

summary

one of the labels of an annotation.

class anndata.ann.annlabel.sppasFuzzyPoint(coord, radius=None)[source]

Bases: object

Data structure to represent a point (x,y) with a radius (r).

Mainly used to represent a point in an image with a vagueness around the midpoint. The fuzzy point is then representing a rectangle area. The radius is half of the vagueness.

(x,y) |
r . |

|<——> | | | + - - - - - - - - +

Two fuzzy points are equals if their area overlaps.

__init__(coord, radius=None)[source]

Create a sppasFuzzyPoint instance.

The given coordinates of the midpoint can be a tuple of int values or a string representing it.

Parameters
  • coord – (int,int) x,y coords of the midpoint value.

  • radius – (int) the radius around the midpoint.

contains(coord)[source]

Check if the given midpoint is inside the vagueness of self.

Parameters

coord – (tuple) An (x, y) coordinates

copy()[source]

Return a deep copy of self.

get_midpoint()[source]

Return the midpoint coords (x,y).

get_radius()[source]

Return the radius value (float or None).

static parse(str_point)[source]

Return a tuple (x,y) or (x,y,r).

Parameters

str_point – (str) A string representing a fuzzy point.

set(other)[source]

Set self members from another sppasFuzzyPoint instance.

Parameters

other – (sppasFuzzyPoint)

set_midpoint(midpoint)[source]

Set the midpoint value.

Parameters

midpoint – (tuple(int,int), str) the new midpoint coords.

Raise

AnnDataTypeError

set_radius(radius=None)[source]

Fix the radius value, ie. the vagueness of the point.

The midpoint value must be set first.

Parameters

radius – (int, str, None) the radius value

Raise

AnnDataTypeError, AnnDataNegValueError

class anndata.ann.annlabel.sppasFuzzyRect(coord, radius=None)[source]

Bases: object

Data structure to represent an area (x,y,w,h) with a radius (r).

Mainly used to represent a rectangle in an image with a vagueness around the midpoint, which is a rectangle. The radius is half of the vagueness.

__init__(coord, radius=None)[source]

Create a sppasFuzzyRect instance.

The given coordinates of the midpoint can be a tuple of int values or a string representing it.

Parameters
  • coord – (int,int,int,int) x,y,w,h coords of the midpoint value.

  • radius – (int) the radius around the midpoint.

contains(coord)[source]

Check if the given point is inside the vagueness of self.

Parameters

coord – (tuple) An (x, y) coordinates

copy()[source]

Return a deep copy of self.

get_midpoint()[source]

Return the midpoint coords (x,y,w,h).

get_radius()[source]

Return the radius value (float or None).

static parse(str_rect)[source]

Return a tuple (x,y,w,h) or (x,y,w,h,r).

Parameters

str_rect – (str) A string representing a fuzzy rect.

set(other)[source]

Set self members from another sppasFuzzyRect instance.

Parameters

other – (sppasFuzzyRect)

set_midpoint(midpoint)[source]

Set the midpoint value.

Parameters

midpoint – (tuple(int,int,int,int), str) the new midpoint coords.

Raise

AnnDataTypeError

set_radius(radius=None)[source]

Fix the radius value, ie. the vagueness of the point.

The midpoint value must be set first.

Parameters

radius – (int, str, None) the radius value

Raise

AnnDataTypeError, AnnDataNegValueError

class anndata.ann.annlabel.sppasLabel(tag, score=None)[source]

Bases: object

Represent the content of an annotation.

sppasLabel allows to store a set of sppasTags with their scores. This class is using a list of lists, i.e. a list of pairs (tag, score). This is the best compromise between memory usage, speed and readability.

A label is a list of possible sppasTag(), represented as a UNICODE string. A data type can be associated, as sppasTag() can be ‘int’, ‘float’ or ‘bool’.

__init__(tag, score=None)[source]

Create a new sppasLabel instance.

Parameters
  • tag – (sppasTag or list of sppasTag or None)

  • score – (float or list of float or None)

append(tag, score=None)[source]

Add a sppasTag into the list.

Do not add the tag if this alternative is already inside the list, but add the scores.

Parameters
  • tag – (sppasTag)

  • score – (float)

append_content(content, data_type='str', score=None)[source]

Add a text into the list.

Parameters
  • content – (str)

  • data_type – (str): The type of this text content.

One of: (str, int, float, bool) :param score: (float)

copy()[source]

Return a deep copy of the label.

get_best()[source]

Return the best sppasTag, i.e. the one with the better score.

Returns

(sppasTag or None)

get_score(tag)[source]

Return the score of a tag or None if tag is not in the label.

Parameters

tag – (sppasTag)

Returns

score: (float)

get_type()[source]

Return the type of the tags content.

is_bool()[source]

Return True if tags are of type “bool”.

Return False if no tag is set.

is_float()[source]

Return True if tags are of type “float”.

Return False if no tag is set.

is_int()[source]

Return True if tags are of type “int”.

Return False if no tag is set.

is_point()[source]

Return True if tags are of type “point”.

Return False if no tag is set.

is_string()[source]

Return True if tags are string or unicode.

Return False if no tag is set.

is_tagged()[source]

Return False if no tag is set.

match(tag_functions, logic_bool='and')[source]

Return True if a tag matches all or any of the functions.

Parameters
  • tag_functions – list of (function, value, logical_not)

  • logic_bool – (str) Apply a logical “and” or a logical “or” between the functions.

Returns

(bool)

  • function: a function in python with 2 arguments: tag/value

  • value: the expected value for the tag

  • logical_not: boolean

Example

Search if a tag is exactly matching “R”:

>>> l.match([(exact, "R", False)])
Example

Search if a tag is starting with “p” or starting with “t”:

>>> l.match([(startswith, "p", False),
>>>          (startswith, "t", False), ], logic_bool="or")
remove(tag)[source]

Remove a tag of the list.

Parameters

tag – (sppasTag) the tag to be removed of the list.

serialize(empty='', alt=True)[source]

Convert the label into a string, include or not alternative tags.

@DeprecationWarning Use aioutils.serialize_label() instead.

set_score(tag, score)[source]

Set a score to a given tag.

Parameters
  • tag – (sppasTag)

  • score – (float)

class anndata.ann.annlabel.sppasTag(tag_content, tag_type=None)[source]

Bases: object

Represent one of the possible tags of a label.

A sppasTag is a data content of any type. By default, the type of the data is “str” and the content is empty, but internally the sppasTag stores ‘None’ values because None is 16 bits and an empty string is 37.

A sppasTag() content can be one of the following types:

  1. string/unicode - (str)

  2. integer - (int)

  3. float - (float)

  4. boolean - (bool)

  5. point - (sppasFuzzyPoint)

  6. rect - (sppasFuzzyRect)

Get access to the content with the get_content() method and to the typed content with get_typed_content().

>>> t1 = sppasTag("2")                      # "2" (str)
>>> t2 = sppasTag(2)                        # "2" (str)
>>> t3 = sppasTag(2, tag_type="int")        # 2 (int)
>>> t4 = sppasTag("2", tag_type="int")      # 2 (int)
>>> t5 = sppasTag("2", tag_type="float")    # 2. (float)
>>> t6 = sppasTag("true", tag_type="bool")  # True (bool)
>>> t7 = sppasTag(0, tag_type="bool")       # False (bool)
>>> t8 = sppasTag((27, 32), tag_type="point")  # x=27, y=32 (point)
>>> t9 = sppasTag((27, 32, 320, 200), tag_type="rect")
TAG_TYPES = ('str', 'float', 'int', 'bool', 'point', 'rect')
__init__(tag_content, tag_type=None)[source]

Initialize a new sppasTag instance.

Parameters
  • tag_content – (any) Data content

  • tag_type – (str): The type of this content. One of: (‘str’, ‘int’, ‘float’, ‘bool’, ‘point’, ‘rect’).

‘str’ is the default tag_type.

copy()[source]

Return a deep copy of self.

get_content()[source]

Return an unicode string corresponding to the content.

Also returns a unicode string in case of a list (elements are separated by a whitespace).

Returns

(unicode)

get_type()[source]

Return the type of the tag content.

get_typed_content()[source]

Return the content value, in its appropriate type.

Excepted for strings which are systematically returned as unicode.

is_dummy()[source]

Return True if the tag is a dummy label.

is_empty()[source]

Return True if the tag is an empty string.

is_laugh()[source]

Return True if the tag is a laughing.

is_noise()[source]

Return True if the tag is a noise.

is_pause()[source]

Return True if the tag is a short pause.

is_silence()[source]

Return True if the tag is a silence.

is_speech()[source]

Return True if the tag is not a silence.

set(other)[source]

Set self members from another sppasTag instance.

Parameters

other – (sppasTag)

set_content(tag_content, tag_type=None)[source]

Change content of this sppasTag.

Parameters
  • tag_content – (any) New text content for this sppasTag

  • tag_type – The type of this tag. Default is ‘str’ to represent an unicode string.

Raise

AnnUnkTypeError, AnnDataTypeError

class anndata.ann.annlabel.sppasTagCompare[source]

Bases: sppas.src.structs.basecompare.sppasBaseCompare

Comparison methods for sppasTag.

Label’tags can be of 3 types in anndata (str, num, bool) so that this class allows to create different comparison methods depending on the type of the tags.

Example

Three different ways to compare a tag content to a given string

>>> tc = sppasTagCompare()
>>> tc.exact(sppasTag("abc"), u("abc"))
>>> tc.methods['exact'](sppasTag("abc"), u("abc"))
>>> tc.get('exact')(sppasTag("abc"), u("abc"))
__init__()[source]

Create a sppasTagCompare instance.

static bool(tag, x)[source]

Return True if boolean value of the tag is equal to boolean x.

Parameters
  • tag – (sppasTag) Tag to compare.

  • x – (bool)

Returns

(bool)

Raises

AnnDataTypeError

static contains(tag, text)[source]

Test if the first text contains the second text.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static endswith(tag, text)[source]

Test if first text ends with the characters of the second text.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static equal(tag, x)[source]

Return True if numerical value of the tag is equal to x.

Parameters
  • tag – (sppasTag) Tag to compare.

  • x – (int, float)

Returns

(bool)

Raises

AnnDataTypeError

static exact(tag, text)[source]

Test if two texts strictly contain the same characters.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static greater(tag, x)[source]

Return True if numerical value of the tag is greater than x.

Parameters
  • tag – (sppasTag) Tag to compare.

  • x – (int, float)

Returns

(bool)

Raises

AnnDataTypeError

static icontains(tag, text)[source]

Case-insensitive contains.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static iendswith(tag, text)[source]

Case-insensitive endswith.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static iexact(tag, text)[source]

Case-insensitive exact.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static istartswith(tag, text)[source]

Case-insensitive startswith.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError

static lower(tag, x)[source]

Return True if numerical value of the tag is lower than x.

Parameters
  • tag – (sppasTag) Tag to compare.

  • x – (int, float)

Returns

(bool)

Raises

AnnDataTypeError

static regexp(tag, pattern)[source]

test if text matches pattern.

Parameters
  • tag – (sppasTag) Tag to compare.

  • pattern – (unicode) Pattern to search.

Returns

(bool)

Raises

AnnDataTypeError

static startswith(tag, text)[source]

Test if first text starts with the characters of the second text.

Parameters
  • tag – (sppasTag) Tag to compare.

  • text – (unicode) Unicode string to be compared with.

Returns

(bool)

Raises

AnnDataTypeError