partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | SampleTrainer.itertrain | Train a model using a training and validation set.
This method yields a series of monitor values to the caller. After every
iteration, a pair of monitor dictionaries is generated: one evaluated on
the training dataset, and another evaluated on the validation dataset.
The validation moni... | theanets/trainer.py | def itertrain(self, train, valid=None, **kwargs):
'''Train a model using a training and validation set.
This method yields a series of monitor values to the caller. After every
iteration, a pair of monitor dictionaries is generated: one evaluated on
the training dataset, and another eva... | def itertrain(self, train, valid=None, **kwargs):
'''Train a model using a training and validation set.
This method yields a series of monitor values to the caller. After every
iteration, a pair of monitor dictionaries is generated: one evaluated on
the training dataset, and another eva... | [
"Train",
"a",
"model",
"using",
"a",
"training",
"and",
"validation",
"set",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/trainer.py#L93-L158 | [
"def",
"itertrain",
"(",
"self",
",",
"train",
",",
"valid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ifci",
"=",
"itertools",
".",
"chain",
".",
"from_iterable",
"def",
"first",
"(",
"x",
")",
":",
"return",
"x",
"[",
"0",
"]",
"if",
"is... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | SupervisedPretrainer.itertrain | Train a model using a training and validation set.
This method yields a series of monitor values to the caller. After every
iteration, a pair of monitor dictionaries is generated: one evaluated on
the training dataset, and another evaluated on the validation dataset.
The validation moni... | theanets/trainer.py | def itertrain(self, train, valid=None, **kwargs):
'''Train a model using a training and validation set.
This method yields a series of monitor values to the caller. After every
iteration, a pair of monitor dictionaries is generated: one evaluated on
the training dataset, and another eva... | def itertrain(self, train, valid=None, **kwargs):
'''Train a model using a training and validation set.
This method yields a series of monitor values to the caller. After every
iteration, a pair of monitor dictionaries is generated: one evaluated on
the training dataset, and another eva... | [
"Train",
"a",
"model",
"using",
"a",
"training",
"and",
"validation",
"set",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/trainer.py#L202-L262 | [
"def",
"itertrain",
"(",
"self",
",",
"train",
",",
"valid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"net",
"=",
"self",
".",
"network",
"original",
"=",
"list",
"(",
"net",
".",
"layers",
")",
"output_name",
"=",
"original",
"[",
"-",
"1",... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | UnsupervisedPretrainer.itertrain | Train a model using a training and validation set.
This method yields a series of monitor values to the caller. After every
iteration, a pair of monitor dictionaries is generated: one evaluated on
the training dataset, and another evaluated on the validation dataset.
The validation moni... | theanets/trainer.py | def itertrain(self, train, valid=None, **kwargs):
'''Train a model using a training and validation set.
This method yields a series of monitor values to the caller. After every
iteration, a pair of monitor dictionaries is generated: one evaluated on
the training dataset, and another eva... | def itertrain(self, train, valid=None, **kwargs):
'''Train a model using a training and validation set.
This method yields a series of monitor values to the caller. After every
iteration, a pair of monitor dictionaries is generated: one evaluated on
the training dataset, and another eva... | [
"Train",
"a",
"model",
"using",
"a",
"training",
"and",
"validation",
"set",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/trainer.py#L281-L337 | [
"def",
"itertrain",
"(",
"self",
",",
"train",
",",
"valid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
"import",
"feedforward",
"original_layer_names",
"=",
"set",
"(",
"l",
".",
"name",
"for",
"l",
"in",
"self",
".",
"network",
".... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.add_layer | Add a :ref:`layer <layers>` to our network graph.
Parameters
----------
layer : int, tuple, dict, or :class:`Layer <theanets.layers.base.Layer>`
A value specifying the layer to add. For more information, please
see :ref:`guide-creating-specifying-layers`. | theanets/graph.py | def add_layer(self, layer=None, **kwargs):
'''Add a :ref:`layer <layers>` to our network graph.
Parameters
----------
layer : int, tuple, dict, or :class:`Layer <theanets.layers.base.Layer>`
A value specifying the layer to add. For more information, please
see :r... | def add_layer(self, layer=None, **kwargs):
'''Add a :ref:`layer <layers>` to our network graph.
Parameters
----------
layer : int, tuple, dict, or :class:`Layer <theanets.layers.base.Layer>`
A value specifying the layer to add. For more information, please
see :r... | [
"Add",
"a",
":",
"ref",
":",
"layer",
"<layers",
">",
"to",
"our",
"network",
"graph",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L101-L198 | [
"def",
"add_layer",
"(",
"self",
",",
"layer",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# if the given layer is a Layer instance, just add it and move on.",
"if",
"isinstance",
"(",
"layer",
",",
"layers",
".",
"Layer",
")",
":",
"self",
".",
"layers",
... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.add_loss | Add a :ref:`loss function <losses>` to the model.
Parameters
----------
loss : str, dict, or :class:`theanets.losses.Loss`
A loss function to add. If this is a Loss instance, it will be added
immediately. If this is a string, it names a loss function to build
... | theanets/graph.py | def add_loss(self, loss=None, **kwargs):
'''Add a :ref:`loss function <losses>` to the model.
Parameters
----------
loss : str, dict, or :class:`theanets.losses.Loss`
A loss function to add. If this is a Loss instance, it will be added
immediately. If this is a s... | def add_loss(self, loss=None, **kwargs):
'''Add a :ref:`loss function <losses>` to the model.
Parameters
----------
loss : str, dict, or :class:`theanets.losses.Loss`
A loss function to add. If this is a Loss instance, it will be added
immediately. If this is a s... | [
"Add",
"a",
":",
"ref",
":",
"loss",
"function",
"<losses",
">",
"to",
"the",
"model",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L200-L229 | [
"def",
"add_loss",
"(",
"self",
",",
"loss",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"loss",
",",
"losses",
".",
"Loss",
")",
":",
"self",
".",
"losses",
".",
"append",
"(",
"loss",
")",
"return",
"form",
"=",
"lo... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.set_loss | Clear the current loss functions from the network and add a new one.
All parameters and keyword arguments are passed to :func:`add_loss`
after clearing the current losses. | theanets/graph.py | def set_loss(self, *args, **kwargs):
'''Clear the current loss functions from the network and add a new one.
All parameters and keyword arguments are passed to :func:`add_loss`
after clearing the current losses.
'''
self.losses = []
self.add_loss(*args, **kwargs) | def set_loss(self, *args, **kwargs):
'''Clear the current loss functions from the network and add a new one.
All parameters and keyword arguments are passed to :func:`add_loss`
after clearing the current losses.
'''
self.losses = []
self.add_loss(*args, **kwargs) | [
"Clear",
"the",
"current",
"loss",
"functions",
"from",
"the",
"network",
"and",
"add",
"a",
"new",
"one",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L231-L238 | [
"def",
"set_loss",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"losses",
"=",
"[",
"]",
"self",
".",
"add_loss",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.itertrain | Train our network, one batch at a time.
This method yields a series of ``(train, valid)`` monitor pairs. The
``train`` value is a dictionary mapping names to monitor values
evaluated on the training dataset. The ``valid`` value is also a
dictionary mapping names to values, but these val... | theanets/graph.py | def itertrain(self, train, valid=None, algo='rmsprop', subalgo='rmsprop',
save_every=0, save_progress=None, **kwargs):
'''Train our network, one batch at a time.
This method yields a series of ``(train, valid)`` monitor pairs. The
``train`` value is a dictionary mapping names ... | def itertrain(self, train, valid=None, algo='rmsprop', subalgo='rmsprop',
save_every=0, save_progress=None, **kwargs):
'''Train our network, one batch at a time.
This method yields a series of ``(train, valid)`` monitor pairs. The
``train`` value is a dictionary mapping names ... | [
"Train",
"our",
"network",
"one",
"batch",
"at",
"a",
"time",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L240-L365 | [
"def",
"itertrain",
"(",
"self",
",",
"train",
",",
"valid",
"=",
"None",
",",
"algo",
"=",
"'rmsprop'",
",",
"subalgo",
"=",
"'rmsprop'",
",",
"save_every",
"=",
"0",
",",
"save_progress",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'rng'... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.train | Train the network until the trainer converges.
All arguments are passed to :func:`itertrain`.
Returns
-------
training : dict
A dictionary of monitor values computed using the training dataset,
at the conclusion of training. This dictionary will at least contain... | theanets/graph.py | def train(self, *args, **kwargs):
'''Train the network until the trainer converges.
All arguments are passed to :func:`itertrain`.
Returns
-------
training : dict
A dictionary of monitor values computed using the training dataset,
at the conclusion of tr... | def train(self, *args, **kwargs):
'''Train the network until the trainer converges.
All arguments are passed to :func:`itertrain`.
Returns
-------
training : dict
A dictionary of monitor values computed using the training dataset,
at the conclusion of tr... | [
"Train",
"the",
"network",
"until",
"the",
"trainer",
"converges",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L367-L386 | [
"def",
"train",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"monitors",
"=",
"None",
"for",
"monitors",
"in",
"self",
".",
"itertrain",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"pass",
"return",
"monitors"
] | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network._hash | Construct a string key for representing a computation graph.
This key will be unique for a given (a) network topology, (b) set of
losses, and (c) set of regularizers.
Returns
-------
key : str
A hash representing the computation graph for the current network. | theanets/graph.py | def _hash(self, regularizers=()):
'''Construct a string key for representing a computation graph.
This key will be unique for a given (a) network topology, (b) set of
losses, and (c) set of regularizers.
Returns
-------
key : str
A hash representing the comp... | def _hash(self, regularizers=()):
'''Construct a string key for representing a computation graph.
This key will be unique for a given (a) network topology, (b) set of
losses, and (c) set of regularizers.
Returns
-------
key : str
A hash representing the comp... | [
"Construct",
"a",
"string",
"key",
"for",
"representing",
"a",
"computation",
"graph",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L388-L408 | [
"def",
"_hash",
"(",
"self",
",",
"regularizers",
"=",
"(",
")",
")",
":",
"def",
"add",
"(",
"s",
")",
":",
"h",
".",
"update",
"(",
"str",
"(",
"s",
")",
".",
"encode",
"(",
"'utf-8'",
")",
")",
"h",
"=",
"hashlib",
".",
"md5",
"(",
")",
... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.build_graph | Connect the layers in this network to form a computation graph.
Parameters
----------
regularizers : list of :class:`theanets.regularizers.Regularizer`
A list of the regularizers to apply while building the computation
graph.
Returns
-------
outp... | theanets/graph.py | def build_graph(self, regularizers=()):
'''Connect the layers in this network to form a computation graph.
Parameters
----------
regularizers : list of :class:`theanets.regularizers.Regularizer`
A list of the regularizers to apply while building the computation
g... | def build_graph(self, regularizers=()):
'''Connect the layers in this network to form a computation graph.
Parameters
----------
regularizers : list of :class:`theanets.regularizers.Regularizer`
A list of the regularizers to apply while building the computation
g... | [
"Connect",
"the",
"layers",
"in",
"this",
"network",
"to",
"form",
"a",
"computation",
"graph",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L410-L443 | [
"def",
"build_graph",
"(",
"self",
",",
"regularizers",
"=",
"(",
")",
")",
":",
"key",
"=",
"self",
".",
"_hash",
"(",
"regularizers",
")",
"if",
"key",
"not",
"in",
"self",
".",
"_graphs",
":",
"util",
".",
"log",
"(",
"'building computation graph'",
... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.inputs | A list of Theano variables for feedforward computations. | theanets/graph.py | def inputs(self):
'''A list of Theano variables for feedforward computations.'''
return [l.input for l in self.layers if isinstance(l, layers.Input)] | def inputs(self):
'''A list of Theano variables for feedforward computations.'''
return [l.input for l in self.layers if isinstance(l, layers.Input)] | [
"A",
"list",
"of",
"Theano",
"variables",
"for",
"feedforward",
"computations",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L446-L448 | [
"def",
"inputs",
"(",
"self",
")",
":",
"return",
"[",
"l",
".",
"input",
"for",
"l",
"in",
"self",
".",
"layers",
"if",
"isinstance",
"(",
"l",
",",
"layers",
".",
"Input",
")",
"]"
] | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.variables | A list of Theano variables for loss computations. | theanets/graph.py | def variables(self):
'''A list of Theano variables for loss computations.'''
result = self.inputs
seen = set(i.name for i in result)
for loss in self.losses:
for v in loss.variables:
if v.name not in seen:
result.append(v)
... | def variables(self):
'''A list of Theano variables for loss computations.'''
result = self.inputs
seen = set(i.name for i in result)
for loss in self.losses:
for v in loss.variables:
if v.name not in seen:
result.append(v)
... | [
"A",
"list",
"of",
"Theano",
"variables",
"for",
"loss",
"computations",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L451-L460 | [
"def",
"variables",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"inputs",
"seen",
"=",
"set",
"(",
"i",
".",
"name",
"for",
"i",
"in",
"result",
")",
"for",
"loss",
"in",
"self",
".",
"losses",
":",
"for",
"v",
"in",
"loss",
".",
"variable... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.find | Get a parameter from a layer in the network.
Parameters
----------
which : int or str
The layer that owns the parameter to return.
If this is an integer, then 0 refers to the input layer, 1 refers
to the first hidden layer, 2 to the second, and so on.
... | theanets/graph.py | def find(self, which, param):
'''Get a parameter from a layer in the network.
Parameters
----------
which : int or str
The layer that owns the parameter to return.
If this is an integer, then 0 refers to the input layer, 1 refers
to the first hidden ... | def find(self, which, param):
'''Get a parameter from a layer in the network.
Parameters
----------
which : int or str
The layer that owns the parameter to return.
If this is an integer, then 0 refers to the input layer, 1 refers
to the first hidden ... | [
"Get",
"a",
"parameter",
"from",
"a",
"layer",
"in",
"the",
"network",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L467-L499 | [
"def",
"find",
"(",
"self",
",",
"which",
",",
"param",
")",
":",
"for",
"i",
",",
"layer",
"in",
"enumerate",
"(",
"self",
".",
"layers",
")",
":",
"if",
"which",
"==",
"i",
"or",
"which",
"==",
"layer",
".",
"name",
":",
"return",
"layer",
".",... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.feed_forward | Compute a forward pass of all layers from the given input.
All keyword arguments are passed directly to :func:`build_graph`.
Parameters
----------
x : ndarray (num-examples, num-variables)
An array containing data to be fed into the network. Multiple
examples ar... | theanets/graph.py | def feed_forward(self, x, **kwargs):
'''Compute a forward pass of all layers from the given input.
All keyword arguments are passed directly to :func:`build_graph`.
Parameters
----------
x : ndarray (num-examples, num-variables)
An array containing data to be fed in... | def feed_forward(self, x, **kwargs):
'''Compute a forward pass of all layers from the given input.
All keyword arguments are passed directly to :func:`build_graph`.
Parameters
----------
x : ndarray (num-examples, num-variables)
An array containing data to be fed in... | [
"Compute",
"a",
"forward",
"pass",
"of",
"all",
"layers",
"from",
"the",
"given",
"input",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L501-L531 | [
"def",
"feed_forward",
"(",
"self",
",",
"x",
",",
"*",
"*",
"kwargs",
")",
":",
"regs",
"=",
"regularizers",
".",
"from_kwargs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"key",
"=",
"self",
".",
"_hash",
"(",
"regs",
")",
"if",
"key",
"not",
"... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.predict | Compute a forward pass of the inputs, returning the network output.
All keyword arguments end up being passed to :func:`build_graph`.
Parameters
----------
x : ndarray (num-examples, num-variables)
An array containing data to be fed into the network. Multiple
ex... | theanets/graph.py | def predict(self, x, **kwargs):
'''Compute a forward pass of the inputs, returning the network output.
All keyword arguments end up being passed to :func:`build_graph`.
Parameters
----------
x : ndarray (num-examples, num-variables)
An array containing data to be fe... | def predict(self, x, **kwargs):
'''Compute a forward pass of the inputs, returning the network output.
All keyword arguments end up being passed to :func:`build_graph`.
Parameters
----------
x : ndarray (num-examples, num-variables)
An array containing data to be fe... | [
"Compute",
"a",
"forward",
"pass",
"of",
"the",
"inputs",
"returning",
"the",
"network",
"output",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L533-L552 | [
"def",
"predict",
"(",
"self",
",",
"x",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"feed_forward",
"(",
"x",
",",
"*",
"*",
"kwargs",
")",
"[",
"self",
".",
"layers",
"[",
"-",
"1",
"]",
".",
"output_name",
"]"
] | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.score | Compute R^2 coefficient of determination for a given labeled input.
Parameters
----------
x : ndarray (num-examples, num-inputs)
An array containing data to be fed into the network. Multiple
examples are arranged as rows in this array, with columns containing
... | theanets/graph.py | def score(self, x, y, w=None, **kwargs):
'''Compute R^2 coefficient of determination for a given labeled input.
Parameters
----------
x : ndarray (num-examples, num-inputs)
An array containing data to be fed into the network. Multiple
examples are arranged as row... | def score(self, x, y, w=None, **kwargs):
'''Compute R^2 coefficient of determination for a given labeled input.
Parameters
----------
x : ndarray (num-examples, num-inputs)
An array containing data to be fed into the network. Multiple
examples are arranged as row... | [
"Compute",
"R^2",
"coefficient",
"of",
"determination",
"for",
"a",
"given",
"labeled",
"input",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L554-L578 | [
"def",
"score",
"(",
"self",
",",
"x",
",",
"y",
",",
"w",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"u",
"=",
"y",
"-",
"self",
".",
"predict",
"(",
"x",
",",
"*",
"*",
"kwargs",
")",
"v",
"=",
"y",
"-",
"y",
".",
"mean",
"(",
")... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.save | Save the state of this network to a pickle file on disk.
Parameters
----------
filename_or_handle : str or file handle
Save the state of this network to a pickle file. If this parameter
is a string, it names the file where the pickle will be saved. If it
is a... | theanets/graph.py | def save(self, filename_or_handle):
'''Save the state of this network to a pickle file on disk.
Parameters
----------
filename_or_handle : str or file handle
Save the state of this network to a pickle file. If this parameter
is a string, it names the file where t... | def save(self, filename_or_handle):
'''Save the state of this network to a pickle file on disk.
Parameters
----------
filename_or_handle : str or file handle
Save the state of this network to a pickle file. If this parameter
is a string, it names the file where t... | [
"Save",
"the",
"state",
"of",
"this",
"network",
"to",
"a",
"pickle",
"file",
"on",
"disk",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L588-L608 | [
"def",
"save",
"(",
"self",
",",
"filename_or_handle",
")",
":",
"if",
"isinstance",
"(",
"filename_or_handle",
",",
"util",
".",
"basestring",
")",
":",
"opener",
"=",
"gzip",
".",
"open",
"if",
"filename_or_handle",
".",
"lower",
"(",
")",
".",
"endswith... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.load | Load a saved network from disk.
Parameters
----------
filename_or_handle : str or file handle
Load the state of this network from a pickle file. If this parameter
is a string, it names the file where the pickle will be saved. If it
is a file-like object, this... | theanets/graph.py | def load(cls, filename_or_handle):
'''Load a saved network from disk.
Parameters
----------
filename_or_handle : str or file handle
Load the state of this network from a pickle file. If this parameter
is a string, it names the file where the pickle will be saved.... | def load(cls, filename_or_handle):
'''Load a saved network from disk.
Parameters
----------
filename_or_handle : str or file handle
Load the state of this network from a pickle file. If this parameter
is a string, it names the file where the pickle will be saved.... | [
"Load",
"a",
"saved",
"network",
"from",
"disk",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L611-L634 | [
"def",
"load",
"(",
"cls",
",",
"filename_or_handle",
")",
":",
"assert",
"not",
"isinstance",
"(",
"cls",
",",
"Network",
")",
",",
"'cannot load an instance! say instead: net = Network.load(source)'",
"if",
"isinstance",
"(",
"filename_or_handle",
",",
"util",
".",
... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.loss | Return a variable representing the regularized loss for this network.
The regularized loss includes both the :ref:`loss computation <losses>`
for the network as well as any :ref:`regularizers <regularizers>` that
are in place.
Keyword arguments are passed directly to
:func:`the... | theanets/graph.py | def loss(self, **kwargs):
'''Return a variable representing the regularized loss for this network.
The regularized loss includes both the :ref:`loss computation <losses>`
for the network as well as any :ref:`regularizers <regularizers>` that
are in place.
Keyword arguments are ... | def loss(self, **kwargs):
'''Return a variable representing the regularized loss for this network.
The regularized loss includes both the :ref:`loss computation <losses>`
for the network as well as any :ref:`regularizers <regularizers>` that
are in place.
Keyword arguments are ... | [
"Return",
"a",
"variable",
"representing",
"the",
"regularized",
"loss",
"for",
"this",
"network",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L636-L654 | [
"def",
"loss",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"regs",
"=",
"regularizers",
".",
"from_kwargs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"outputs",
",",
"_",
"=",
"self",
".",
"build_graph",
"(",
"regs",
")",
"return",
"sum",
"(",... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.monitors | Return expressions that should be computed to monitor training.
Returns
-------
monitors : list of (name, expression) pairs
A list of named monitor expressions to compute for this network. | theanets/graph.py | def monitors(self, **kwargs):
'''Return expressions that should be computed to monitor training.
Returns
-------
monitors : list of (name, expression) pairs
A list of named monitor expressions to compute for this network.
'''
regs = regularizers.from_kwargs(s... | def monitors(self, **kwargs):
'''Return expressions that should be computed to monitor training.
Returns
-------
monitors : list of (name, expression) pairs
A list of named monitor expressions to compute for this network.
'''
regs = regularizers.from_kwargs(s... | [
"Return",
"expressions",
"that",
"should",
"be",
"computed",
"to",
"monitor",
"training",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L656-L698 | [
"def",
"monitors",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"regs",
"=",
"regularizers",
".",
"from_kwargs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"outputs",
",",
"_",
"=",
"self",
".",
"build_graph",
"(",
"regs",
")",
"monitors",
"=",
... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Network.updates | Return expressions to run as updates during network training.
Returns
-------
updates : list of (parameter, expression) pairs
A list of named parameter update expressions for this network. | theanets/graph.py | def updates(self, **kwargs):
'''Return expressions to run as updates during network training.
Returns
-------
updates : list of (parameter, expression) pairs
A list of named parameter update expressions for this network.
'''
regs = regularizers.from_kwargs(se... | def updates(self, **kwargs):
'''Return expressions to run as updates during network training.
Returns
-------
updates : list of (parameter, expression) pairs
A list of named parameter update expressions for this network.
'''
regs = regularizers.from_kwargs(se... | [
"Return",
"expressions",
"to",
"run",
"as",
"updates",
"during",
"network",
"training",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/graph.py#L700-L710 | [
"def",
"updates",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"regs",
"=",
"regularizers",
".",
"from_kwargs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"_",
",",
"updates",
"=",
"self",
".",
"build_graph",
"(",
"regs",
")",
"return",
"updates"
... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.input_name | Name of layer input (for layers with one input). | theanets/layers/base.py | def input_name(self):
'''Name of layer input (for layers with one input).'''
if len(self._input_shapes) != 1:
raise util.ConfigurationError(
'expected one input for layer "{}", got {}'
.format(self.name, self._input_shapes))
return list(self._input_sha... | def input_name(self):
'''Name of layer input (for layers with one input).'''
if len(self._input_shapes) != 1:
raise util.ConfigurationError(
'expected one input for layer "{}", got {}'
.format(self.name, self._input_shapes))
return list(self._input_sha... | [
"Name",
"of",
"layer",
"input",
"(",
"for",
"layers",
"with",
"one",
"input",
")",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L134-L140 | [
"def",
"input_name",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"_input_shapes",
")",
"!=",
"1",
":",
"raise",
"util",
".",
"ConfigurationError",
"(",
"'expected one input for layer \"{}\", got {}'",
".",
"format",
"(",
"self",
".",
"name",
",",
"... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.input_size | Size of layer input (for layers with one input). | theanets/layers/base.py | def input_size(self):
'''Size of layer input (for layers with one input).'''
shape = self.input_shape
if shape is None:
raise util.ConfigurationError(
'undefined input size for layer "{}"'.format(self.name))
return shape[-1] | def input_size(self):
'''Size of layer input (for layers with one input).'''
shape = self.input_shape
if shape is None:
raise util.ConfigurationError(
'undefined input size for layer "{}"'.format(self.name))
return shape[-1] | [
"Size",
"of",
"layer",
"input",
"(",
"for",
"layers",
"with",
"one",
"input",
")",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L148-L154 | [
"def",
"input_size",
"(",
"self",
")",
":",
"shape",
"=",
"self",
".",
"input_shape",
"if",
"shape",
"is",
"None",
":",
"raise",
"util",
".",
"ConfigurationError",
"(",
"'undefined input size for layer \"{}\"'",
".",
"format",
"(",
"self",
".",
"name",
")",
... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.output_size | Number of "neurons" in this layer's default output. | theanets/layers/base.py | def output_size(self):
'''Number of "neurons" in this layer's default output.'''
shape = self.output_shape
if shape is None:
raise util.ConfigurationError(
'undefined output size for layer "{}"'.format(self.name))
return shape[-1] | def output_size(self):
'''Number of "neurons" in this layer's default output.'''
shape = self.output_shape
if shape is None:
raise util.ConfigurationError(
'undefined output size for layer "{}"'.format(self.name))
return shape[-1] | [
"Number",
"of",
"neurons",
"in",
"this",
"layer",
"s",
"default",
"output",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L167-L173 | [
"def",
"output_size",
"(",
"self",
")",
":",
"shape",
"=",
"self",
".",
"output_shape",
"if",
"shape",
"is",
"None",
":",
"raise",
"util",
".",
"ConfigurationError",
"(",
"'undefined output size for layer \"{}\"'",
".",
"format",
"(",
"self",
".",
"name",
")",... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.connect | Create Theano variables representing the outputs of this layer.
Parameters
----------
inputs : dict of Theano expressions
Symbolic inputs to this layer, given as a dictionary mapping string
names to Theano expressions. Each string key should be of the form
"{... | theanets/layers/base.py | def connect(self, inputs):
'''Create Theano variables representing the outputs of this layer.
Parameters
----------
inputs : dict of Theano expressions
Symbolic inputs to this layer, given as a dictionary mapping string
names to Theano expressions. Each string ke... | def connect(self, inputs):
'''Create Theano variables representing the outputs of this layer.
Parameters
----------
inputs : dict of Theano expressions
Symbolic inputs to this layer, given as a dictionary mapping string
names to Theano expressions. Each string ke... | [
"Create",
"Theano",
"variables",
"representing",
"the",
"outputs",
"of",
"this",
"layer",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L190-L217 | [
"def",
"connect",
"(",
"self",
",",
"inputs",
")",
":",
"outputs",
",",
"updates",
"=",
"self",
".",
"transform",
"(",
"inputs",
")",
"# transform the outputs to be a list of ordered pairs if needed.",
"if",
"isinstance",
"(",
"outputs",
",",
"dict",
")",
":",
"... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.bind | Bind this layer into a computation graph.
This method is a wrapper for performing common initialization tasks. It
calls :func:`resolve`, :func:`setup`, and :func:`log`.
Parameters
----------
graph : :class:`Network <theanets.graph.Network>`
A computation network in ... | theanets/layers/base.py | def bind(self, graph, reset=True, initialize=True):
'''Bind this layer into a computation graph.
This method is a wrapper for performing common initialization tasks. It
calls :func:`resolve`, :func:`setup`, and :func:`log`.
Parameters
----------
graph : :class:`Network ... | def bind(self, graph, reset=True, initialize=True):
'''Bind this layer into a computation graph.
This method is a wrapper for performing common initialization tasks. It
calls :func:`resolve`, :func:`setup`, and :func:`log`.
Parameters
----------
graph : :class:`Network ... | [
"Bind",
"this",
"layer",
"into",
"a",
"computation",
"graph",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L237-L269 | [
"def",
"bind",
"(",
"self",
",",
"graph",
",",
"reset",
"=",
"True",
",",
"initialize",
"=",
"True",
")",
":",
"if",
"reset",
":",
"for",
"k",
"in",
"self",
".",
"_input_shapes",
":",
"self",
".",
"_input_shapes",
"[",
"k",
"]",
"=",
"None",
"for",... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.resolve_inputs | Resolve the names of inputs for this layer into shape tuples.
Parameters
----------
layers : list of :class:`Layer`
A list of the layers that are available for resolving inputs.
Raises
------
theanets.util.ConfigurationError :
If an input cannot ... | theanets/layers/base.py | def resolve_inputs(self, layers):
'''Resolve the names of inputs for this layer into shape tuples.
Parameters
----------
layers : list of :class:`Layer`
A list of the layers that are available for resolving inputs.
Raises
------
theanets.util.Configu... | def resolve_inputs(self, layers):
'''Resolve the names of inputs for this layer into shape tuples.
Parameters
----------
layers : list of :class:`Layer`
A list of the layers that are available for resolving inputs.
Raises
------
theanets.util.Configu... | [
"Resolve",
"the",
"names",
"of",
"inputs",
"for",
"this",
"layer",
"into",
"shape",
"tuples",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L271-L289 | [
"def",
"resolve_inputs",
"(",
"self",
",",
"layers",
")",
":",
"resolved",
"=",
"{",
"}",
"for",
"name",
",",
"shape",
"in",
"self",
".",
"_input_shapes",
".",
"items",
"(",
")",
":",
"if",
"shape",
"is",
"None",
":",
"name",
",",
"shape",
"=",
"se... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.resolve_outputs | Resolve the names of outputs for this layer into shape tuples. | theanets/layers/base.py | def resolve_outputs(self):
'''Resolve the names of outputs for this layer into shape tuples.'''
input_shape = None
for i, shape in enumerate(self._input_shapes.values()):
if i == 0:
input_shape = shape
if len(input_shape) != len(shape) or any(
... | def resolve_outputs(self):
'''Resolve the names of outputs for this layer into shape tuples.'''
input_shape = None
for i, shape in enumerate(self._input_shapes.values()):
if i == 0:
input_shape = shape
if len(input_shape) != len(shape) or any(
... | [
"Resolve",
"the",
"names",
"of",
"outputs",
"for",
"this",
"layer",
"into",
"shape",
"tuples",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L291-L312 | [
"def",
"resolve_outputs",
"(",
"self",
")",
":",
"input_shape",
"=",
"None",
"for",
"i",
",",
"shape",
"in",
"enumerate",
"(",
"self",
".",
"_input_shapes",
".",
"values",
"(",
")",
")",
":",
"if",
"i",
"==",
"0",
":",
"input_shape",
"=",
"shape",
"i... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.log | Log some information about this layer. | theanets/layers/base.py | def log(self):
'''Log some information about this layer.'''
inputs = ', '.join('"{0}" {1}'.format(*ns) for ns in self._input_shapes.items())
util.log('layer {0.__class__.__name__} "{0.name}" {0.output_shape} {1} from {2}',
self, getattr(self.activate, 'name', self.activate), inp... | def log(self):
'''Log some information about this layer.'''
inputs = ', '.join('"{0}" {1}'.format(*ns) for ns in self._input_shapes.items())
util.log('layer {0.__class__.__name__} "{0.name}" {0.output_shape} {1} from {2}',
self, getattr(self.activate, 'name', self.activate), inp... | [
"Log",
"some",
"information",
"about",
"this",
"layer",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L318-L323 | [
"def",
"log",
"(",
"self",
")",
":",
"inputs",
"=",
"', '",
".",
"join",
"(",
"'\"{0}\" {1}'",
".",
"format",
"(",
"*",
"ns",
")",
"for",
"ns",
"in",
"self",
".",
"_input_shapes",
".",
"items",
"(",
")",
")",
"util",
".",
"log",
"(",
"'layer {0.__c... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.log_params | Log information about this layer's parameters. | theanets/layers/base.py | def log_params(self):
'''Log information about this layer's parameters.'''
total = 0
for p in self.params:
shape = p.get_value().shape
util.log('parameter "{}" {}', p.name, shape)
total += np.prod(shape)
return total | def log_params(self):
'''Log information about this layer's parameters.'''
total = 0
for p in self.params:
shape = p.get_value().shape
util.log('parameter "{}" {}', p.name, shape)
total += np.prod(shape)
return total | [
"Log",
"information",
"about",
"this",
"layer",
"s",
"parameters",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L325-L332 | [
"def",
"log_params",
"(",
"self",
")",
":",
"total",
"=",
"0",
"for",
"p",
"in",
"self",
".",
"params",
":",
"shape",
"=",
"p",
".",
"get_value",
"(",
")",
".",
"shape",
"util",
".",
"log",
"(",
"'parameter \"{}\" {}'",
",",
"p",
".",
"name",
",",
... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer._fmt | Helper method to format our name into a string. | theanets/layers/base.py | def _fmt(self, string):
'''Helper method to format our name into a string.'''
if '{' not in string:
string = '{}.' + string
return string.format(self.name) | def _fmt(self, string):
'''Helper method to format our name into a string.'''
if '{' not in string:
string = '{}.' + string
return string.format(self.name) | [
"Helper",
"method",
"to",
"format",
"our",
"name",
"into",
"a",
"string",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L334-L338 | [
"def",
"_fmt",
"(",
"self",
",",
"string",
")",
":",
"if",
"'{'",
"not",
"in",
"string",
":",
"string",
"=",
"'{}.'",
"+",
"string",
"return",
"string",
".",
"format",
"(",
"self",
".",
"name",
")"
] | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer._resolve_shape | Given a list of layers, find the layer output with the given name.
Parameters
----------
name : str
Name of a layer to resolve.
layers : list of :class:`theanets.layers.base.Layer`
A list of layers to search in.
Raises
------
util.Configu... | theanets/layers/base.py | def _resolve_shape(self, name, layers):
'''Given a list of layers, find the layer output with the given name.
Parameters
----------
name : str
Name of a layer to resolve.
layers : list of :class:`theanets.layers.base.Layer`
A list of layers to search in.
... | def _resolve_shape(self, name, layers):
'''Given a list of layers, find the layer output with the given name.
Parameters
----------
name : str
Name of a layer to resolve.
layers : list of :class:`theanets.layers.base.Layer`
A list of layers to search in.
... | [
"Given",
"a",
"list",
"of",
"layers",
"find",
"the",
"layer",
"output",
"with",
"the",
"given",
"name",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L340-L368 | [
"def",
"_resolve_shape",
"(",
"self",
",",
"name",
",",
"layers",
")",
":",
"matches",
"=",
"[",
"l",
"for",
"l",
"in",
"layers",
"if",
"name",
".",
"split",
"(",
"':'",
")",
"[",
"0",
"]",
"==",
"l",
".",
"name",
"]",
"if",
"len",
"(",
"matche... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.find | Get a shared variable for a parameter by name.
Parameters
----------
key : str or int
The name of the parameter to look up, or the index of the parameter
in our parameter list. These are both dependent on the
implementation of the layer.
Returns
... | theanets/layers/base.py | def find(self, key):
'''Get a shared variable for a parameter by name.
Parameters
----------
key : str or int
The name of the parameter to look up, or the index of the parameter
in our parameter list. These are both dependent on the
implementation of ... | def find(self, key):
'''Get a shared variable for a parameter by name.
Parameters
----------
key : str or int
The name of the parameter to look up, or the index of the parameter
in our parameter list. These are both dependent on the
implementation of ... | [
"Get",
"a",
"shared",
"variable",
"for",
"a",
"parameter",
"by",
"name",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L370-L394 | [
"def",
"find",
"(",
"self",
",",
"key",
")",
":",
"name",
"=",
"self",
".",
"_fmt",
"(",
"str",
"(",
"key",
")",
")",
"for",
"i",
",",
"p",
"in",
"enumerate",
"(",
"self",
".",
"_params",
")",
":",
"if",
"key",
"==",
"i",
"or",
"name",
"==",
... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.add_weights | Helper method to create a new weight matrix.
Parameters
----------
name : str
Name of the parameter to add.
nin : int
Size of "input" for this weight matrix.
nout : int
Size of "output" for this weight matrix.
mean : float, optional
... | theanets/layers/base.py | def add_weights(self, name, nin, nout, mean=0, std=0, sparsity=0, diagonal=0):
'''Helper method to create a new weight matrix.
Parameters
----------
name : str
Name of the parameter to add.
nin : int
Size of "input" for this weight matrix.
nout : ... | def add_weights(self, name, nin, nout, mean=0, std=0, sparsity=0, diagonal=0):
'''Helper method to create a new weight matrix.
Parameters
----------
name : str
Name of the parameter to add.
nin : int
Size of "input" for this weight matrix.
nout : ... | [
"Helper",
"method",
"to",
"create",
"a",
"new",
"weight",
"matrix",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L396-L430 | [
"def",
"add_weights",
"(",
"self",
",",
"name",
",",
"nin",
",",
"nout",
",",
"mean",
"=",
"0",
",",
"std",
"=",
"0",
",",
"sparsity",
"=",
"0",
",",
"diagonal",
"=",
"0",
")",
":",
"glorot",
"=",
"1",
"/",
"np",
".",
"sqrt",
"(",
"nin",
"+",... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.add_bias | Helper method to create a new bias vector.
Parameters
----------
name : str
Name of the parameter to add.
size : int
Size of the bias vector.
mean : float, optional
Mean value for randomly-initialized biases. Defaults to 0.
std : float... | theanets/layers/base.py | def add_bias(self, name, size, mean=0, std=1):
'''Helper method to create a new bias vector.
Parameters
----------
name : str
Name of the parameter to add.
size : int
Size of the bias vector.
mean : float, optional
Mean value for rando... | def add_bias(self, name, size, mean=0, std=1):
'''Helper method to create a new bias vector.
Parameters
----------
name : str
Name of the parameter to add.
size : int
Size of the bias vector.
mean : float, optional
Mean value for rando... | [
"Helper",
"method",
"to",
"create",
"a",
"new",
"bias",
"vector",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L432-L450 | [
"def",
"add_bias",
"(",
"self",
",",
"name",
",",
"size",
",",
"mean",
"=",
"0",
",",
"std",
"=",
"1",
")",
":",
"mean",
"=",
"self",
".",
"kwargs",
".",
"get",
"(",
"'mean_{}'",
".",
"format",
"(",
"name",
")",
",",
"mean",
")",
"std",
"=",
... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | Layer.to_spec | Create a specification dictionary for this layer.
Returns
-------
spec : dict
A dictionary specifying the configuration of this layer. | theanets/layers/base.py | def to_spec(self):
'''Create a specification dictionary for this layer.
Returns
-------
spec : dict
A dictionary specifying the configuration of this layer.
'''
spec = dict(**self.kwargs)
spec.update(
form=self.__class__.__name__.lower(),
... | def to_spec(self):
'''Create a specification dictionary for this layer.
Returns
-------
spec : dict
A dictionary specifying the configuration of this layer.
'''
spec = dict(**self.kwargs)
spec.update(
form=self.__class__.__name__.lower(),
... | [
"Create",
"a",
"specification",
"dictionary",
"for",
"this",
"layer",
"."
] | lmjohns3/theanets | python | https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/layers/base.py#L452-L466 | [
"def",
"to_spec",
"(",
"self",
")",
":",
"spec",
"=",
"dict",
"(",
"*",
"*",
"self",
".",
"kwargs",
")",
"spec",
".",
"update",
"(",
"form",
"=",
"self",
".",
"__class__",
".",
"__name__",
".",
"lower",
"(",
")",
",",
"name",
"=",
"self",
".",
... | 79db9f878ef2071f2f576a1cf5d43a752a55894a |
test | LogGabor.argmax | Returns the ArgMax from C by returning the
(x_pos, y_pos, theta, scale) tuple
>>> C = np.random.randn(10, 10, 5, 4)
>>> x_pos, y_pos, theta, scale = mp.argmax(C)
>>> C[x_pos][y_pos][theta][scale] = C.max() | LogGabor/LogGabor.py | def argmax(self, C):
"""
Returns the ArgMax from C by returning the
(x_pos, y_pos, theta, scale) tuple
>>> C = np.random.randn(10, 10, 5, 4)
>>> x_pos, y_pos, theta, scale = mp.argmax(C)
>>> C[x_pos][y_pos][theta][scale] = C.max()
"""
ind = np.absolute(... | def argmax(self, C):
"""
Returns the ArgMax from C by returning the
(x_pos, y_pos, theta, scale) tuple
>>> C = np.random.randn(10, 10, 5, 4)
>>> x_pos, y_pos, theta, scale = mp.argmax(C)
>>> C[x_pos][y_pos][theta][scale] = C.max()
"""
ind = np.absolute(... | [
"Returns",
"the",
"ArgMax",
"from",
"C",
"by",
"returning",
"the",
"(",
"x_pos",
"y_pos",
"theta",
"scale",
")",
"tuple"
] | bicv/LogGabor | python | https://github.com/bicv/LogGabor/blob/dea9560d8752cc9aa040ac3fd895cf9bb72b61f4/LogGabor/LogGabor.py#L48-L59 | [
"def",
"argmax",
"(",
"self",
",",
"C",
")",
":",
"ind",
"=",
"np",
".",
"absolute",
"(",
"C",
")",
".",
"argmax",
"(",
")",
"return",
"np",
".",
"unravel_index",
"(",
"ind",
",",
"C",
".",
"shape",
")"
] | dea9560d8752cc9aa040ac3fd895cf9bb72b61f4 |
test | LogGabor.golden_pyramid | The Golden Laplacian Pyramid.
To represent the edges of the image at different levels, we may use a simple recursive approach constructing progressively a set of images of decreasing sizes, from a base to the summit of a pyramid. Using simple down-scaling and up-scaling operators we may approximate well a Lapla... | LogGabor/LogGabor.py | def golden_pyramid(self, z, mask=False, spiral=True, fig_width=13):
"""
The Golden Laplacian Pyramid.
To represent the edges of the image at different levels, we may use a simple recursive approach constructing progressively a set of images of decreasing sizes, from a base to the summit of a pyr... | def golden_pyramid(self, z, mask=False, spiral=True, fig_width=13):
"""
The Golden Laplacian Pyramid.
To represent the edges of the image at different levels, we may use a simple recursive approach constructing progressively a set of images of decreasing sizes, from a base to the summit of a pyr... | [
"The",
"Golden",
"Laplacian",
"Pyramid",
".",
"To",
"represent",
"the",
"edges",
"of",
"the",
"image",
"at",
"different",
"levels",
"we",
"may",
"use",
"a",
"simple",
"recursive",
"approach",
"constructing",
"progressively",
"a",
"set",
"of",
"images",
"of",
... | bicv/LogGabor | python | https://github.com/bicv/LogGabor/blob/dea9560d8752cc9aa040ac3fd895cf9bb72b61f4/LogGabor/LogGabor.py#L61-L120 | [
"def",
"golden_pyramid",
"(",
"self",
",",
"z",
",",
"mask",
"=",
"False",
",",
"spiral",
"=",
"True",
",",
"fig_width",
"=",
"13",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"opts",
"=",
"{",
"'vmin'",
":",
"0.",
",",
"'vmax'",
... | dea9560d8752cc9aa040ac3fd895cf9bb72b61f4 |
test | LogGabor.band | Returns the radial frequency envelope:
Selects a preferred spatial frequency ``sf_0`` and a bandwidth ``B_sf``. | LogGabor/LogGabor.py | def band(self, sf_0, B_sf, force=False):
"""
Returns the radial frequency envelope:
Selects a preferred spatial frequency ``sf_0`` and a bandwidth ``B_sf``.
"""
if sf_0 == 0.:
return 1.
elif self.pe.use_cache and not force:
tag = str(sf_0) + '_' ... | def band(self, sf_0, B_sf, force=False):
"""
Returns the radial frequency envelope:
Selects a preferred spatial frequency ``sf_0`` and a bandwidth ``B_sf``.
"""
if sf_0 == 0.:
return 1.
elif self.pe.use_cache and not force:
tag = str(sf_0) + '_' ... | [
"Returns",
"the",
"radial",
"frequency",
"envelope",
":"
] | bicv/LogGabor | python | https://github.com/bicv/LogGabor/blob/dea9560d8752cc9aa040ac3fd895cf9bb72b61f4/LogGabor/LogGabor.py#L123-L143 | [
"def",
"band",
"(",
"self",
",",
"sf_0",
",",
"B_sf",
",",
"force",
"=",
"False",
")",
":",
"if",
"sf_0",
"==",
"0.",
":",
"return",
"1.",
"elif",
"self",
".",
"pe",
".",
"use_cache",
"and",
"not",
"force",
":",
"tag",
"=",
"str",
"(",
"sf_0",
... | dea9560d8752cc9aa040ac3fd895cf9bb72b61f4 |
test | LogGabor.orientation | Returns the orientation envelope:
We use a von-Mises distribution on the orientation:
- mean orientation is ``theta`` (in radians),
- ``B_theta`` is the bandwidth (in radians). It is equal to the standard deviation of the Gaussian
envelope which approximate the distribution for low bandw... | LogGabor/LogGabor.py | def orientation(self, theta, B_theta, force=False):
"""
Returns the orientation envelope:
We use a von-Mises distribution on the orientation:
- mean orientation is ``theta`` (in radians),
- ``B_theta`` is the bandwidth (in radians). It is equal to the standard deviation of the Ga... | def orientation(self, theta, B_theta, force=False):
"""
Returns the orientation envelope:
We use a von-Mises distribution on the orientation:
- mean orientation is ``theta`` (in radians),
- ``B_theta`` is the bandwidth (in radians). It is equal to the standard deviation of the Ga... | [
"Returns",
"the",
"orientation",
"envelope",
":",
"We",
"use",
"a",
"von",
"-",
"Mises",
"distribution",
"on",
"the",
"orientation",
":",
"-",
"mean",
"orientation",
"is",
"theta",
"(",
"in",
"radians",
")",
"-",
"B_theta",
"is",
"the",
"bandwidth",
"(",
... | bicv/LogGabor | python | https://github.com/bicv/LogGabor/blob/dea9560d8752cc9aa040ac3fd895cf9bb72b61f4/LogGabor/LogGabor.py#L145-L175 | [
"def",
"orientation",
"(",
"self",
",",
"theta",
",",
"B_theta",
",",
"force",
"=",
"False",
")",
":",
"if",
"B_theta",
"is",
"np",
".",
"inf",
":",
"# for large bandwidth, returns a strictly flat envelope",
"enveloppe_orientation",
"=",
"1.",
"elif",
"self",
".... | dea9560d8752cc9aa040ac3fd895cf9bb72b61f4 |
test | LogGabor.loggabor | Returns the envelope of a LogGabor
Note that the convention for coordinates follows that of matrices:
the origin is at the top left of the image, and coordinates are first
the rows (vertical axis, going down) then the columns (horizontal axis,
going right). | LogGabor/LogGabor.py | def loggabor(self, x_pos, y_pos, sf_0, B_sf, theta, B_theta, preprocess=True):
"""
Returns the envelope of a LogGabor
Note that the convention for coordinates follows that of matrices:
the origin is at the top left of the image, and coordinates are first
the rows (vertical axis,... | def loggabor(self, x_pos, y_pos, sf_0, B_sf, theta, B_theta, preprocess=True):
"""
Returns the envelope of a LogGabor
Note that the convention for coordinates follows that of matrices:
the origin is at the top left of the image, and coordinates are first
the rows (vertical axis,... | [
"Returns",
"the",
"envelope",
"of",
"a",
"LogGabor"
] | bicv/LogGabor | python | https://github.com/bicv/LogGabor/blob/dea9560d8752cc9aa040ac3fd895cf9bb72b61f4/LogGabor/LogGabor.py#L178-L197 | [
"def",
"loggabor",
"(",
"self",
",",
"x_pos",
",",
"y_pos",
",",
"sf_0",
",",
"B_sf",
",",
"theta",
",",
"B_theta",
",",
"preprocess",
"=",
"True",
")",
":",
"env",
"=",
"np",
".",
"multiply",
"(",
"self",
".",
"band",
"(",
"sf_0",
",",
"B_sf",
"... | dea9560d8752cc9aa040ac3fd895cf9bb72b61f4 |
test | LogGabor.loggabor_image | Returns the image of a LogGabor
Note that the convention for coordinates follows that of matrices:
the origin is at the top left of the image, and coordinates are first
the rows (vertical axis, going down) then the columns (horizontal axis,
going right). | LogGabor/LogGabor.py | def loggabor_image(self, x_pos, y_pos, theta, sf_0, phase, B_sf, B_theta):
"""
Returns the image of a LogGabor
Note that the convention for coordinates follows that of matrices:
the origin is at the top left of the image, and coordinates are first
the rows (vertical axis, going ... | def loggabor_image(self, x_pos, y_pos, theta, sf_0, phase, B_sf, B_theta):
"""
Returns the image of a LogGabor
Note that the convention for coordinates follows that of matrices:
the origin is at the top left of the image, and coordinates are first
the rows (vertical axis, going ... | [
"Returns",
"the",
"image",
"of",
"a",
"LogGabor"
] | bicv/LogGabor | python | https://github.com/bicv/LogGabor/blob/dea9560d8752cc9aa040ac3fd895cf9bb72b61f4/LogGabor/LogGabor.py#L199-L212 | [
"def",
"loggabor_image",
"(",
"self",
",",
"x_pos",
",",
"y_pos",
",",
"theta",
",",
"sf_0",
",",
"phase",
",",
"B_sf",
",",
"B_theta",
")",
":",
"FT_lg",
"=",
"self",
".",
"loggabor",
"(",
"x_pos",
",",
"y_pos",
",",
"sf_0",
"=",
"sf_0",
",",
"B_s... | dea9560d8752cc9aa040ac3fd895cf9bb72b61f4 |
test | TextGrid.from_file | Read textgrid from stream.
:param file ifile: Stream to read from.
:param str codec: Text encoding for the input. Note that this will be
ignored for binary TextGrids. | pympi/Praat.py | def from_file(self, ifile, codec='ascii'):
"""Read textgrid from stream.
:param file ifile: Stream to read from.
:param str codec: Text encoding for the input. Note that this will be
ignored for binary TextGrids.
"""
if ifile.read(12) == b'ooBinaryFile':
... | def from_file(self, ifile, codec='ascii'):
"""Read textgrid from stream.
:param file ifile: Stream to read from.
:param str codec: Text encoding for the input. Note that this will be
ignored for binary TextGrids.
"""
if ifile.read(12) == b'ooBinaryFile':
... | [
"Read",
"textgrid",
"from",
"stream",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L49-L130 | [
"def",
"from_file",
"(",
"self",
",",
"ifile",
",",
"codec",
"=",
"'ascii'",
")",
":",
"if",
"ifile",
".",
"read",
"(",
"12",
")",
"==",
"b'ooBinaryFile'",
":",
"def",
"bin2str",
"(",
"ifile",
")",
":",
"textlen",
"=",
"struct",
".",
"unpack",
"(",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | TextGrid.sort_tiers | Sort the tiers given the key. Example key functions:
Sort according to the tiername in a list:
``lambda x: ['name1', 'name2' ... 'namen'].index(x.name)``.
Sort according to the number of annotations:
``lambda x: len(list(x.get_intervals()))``
:param func key: A key function.... | pympi/Praat.py | def sort_tiers(self, key=lambda x: x.name):
"""Sort the tiers given the key. Example key functions:
Sort according to the tiername in a list:
``lambda x: ['name1', 'name2' ... 'namen'].index(x.name)``.
Sort according to the number of annotations:
``lambda x: len(list(x.get_in... | def sort_tiers(self, key=lambda x: x.name):
"""Sort the tiers given the key. Example key functions:
Sort according to the tiername in a list:
``lambda x: ['name1', 'name2' ... 'namen'].index(x.name)``.
Sort according to the number of annotations:
``lambda x: len(list(x.get_in... | [
"Sort",
"the",
"tiers",
"given",
"the",
"key",
".",
"Example",
"key",
"functions",
":"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L132-L145 | [
"def",
"sort_tiers",
"(",
"self",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
".",
"name",
")",
":",
"self",
".",
"tiers",
".",
"sort",
"(",
"key",
"=",
"key",
")"
] | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | TextGrid.add_tier | Add an IntervalTier or a TextTier on the specified location.
:param str name: Name of the tier, duplicate names is allowed.
:param str tier_type: Type of the tier.
:param int number: Place to insert the tier, when ``None`` the number
is generated and the tier will be placed on the b... | pympi/Praat.py | def add_tier(self, name, tier_type='IntervalTier', number=None):
"""Add an IntervalTier or a TextTier on the specified location.
:param str name: Name of the tier, duplicate names is allowed.
:param str tier_type: Type of the tier.
:param int number: Place to insert the tier, when ``Non... | def add_tier(self, name, tier_type='IntervalTier', number=None):
"""Add an IntervalTier or a TextTier on the specified location.
:param str name: Name of the tier, duplicate names is allowed.
:param str tier_type: Type of the tier.
:param int number: Place to insert the tier, when ``Non... | [
"Add",
"an",
"IntervalTier",
"or",
"a",
"TextTier",
"on",
"the",
"specified",
"location",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L147-L165 | [
"def",
"add_tier",
"(",
"self",
",",
"name",
",",
"tier_type",
"=",
"'IntervalTier'",
",",
"number",
"=",
"None",
")",
":",
"if",
"number",
"is",
"None",
":",
"number",
"=",
"1",
"if",
"not",
"self",
".",
"tiers",
"else",
"len",
"(",
"self",
".",
"... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | TextGrid.remove_tier | Remove a tier, when multiple tiers exist with that name only the
first is removed.
:param name_num: Name or number of the tier to remove.
:type name_num: int or str
:raises IndexError: If there is no tier with that number. | pympi/Praat.py | def remove_tier(self, name_num):
"""Remove a tier, when multiple tiers exist with that name only the
first is removed.
:param name_num: Name or number of the tier to remove.
:type name_num: int or str
:raises IndexError: If there is no tier with that number.
"""
... | def remove_tier(self, name_num):
"""Remove a tier, when multiple tiers exist with that name only the
first is removed.
:param name_num: Name or number of the tier to remove.
:type name_num: int or str
:raises IndexError: If there is no tier with that number.
"""
... | [
"Remove",
"a",
"tier",
"when",
"multiple",
"tiers",
"exist",
"with",
"that",
"name",
"only",
"the",
"first",
"is",
"removed",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L167-L178 | [
"def",
"remove_tier",
"(",
"self",
",",
"name_num",
")",
":",
"if",
"isinstance",
"(",
"name_num",
",",
"int",
")",
":",
"del",
"(",
"self",
".",
"tiers",
"[",
"name_num",
"-",
"1",
"]",
")",
"else",
":",
"self",
".",
"tiers",
"=",
"[",
"i",
"for... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | TextGrid.get_tier | Gives a tier, when multiple tiers exist with that name only the
first is returned.
:param name_num: Name or number of the tier to return.
:type name_num: int or str
:returns: The tier.
:raises IndexError: If the tier doesn't exist. | pympi/Praat.py | def get_tier(self, name_num):
"""Gives a tier, when multiple tiers exist with that name only the
first is returned.
:param name_num: Name or number of the tier to return.
:type name_num: int or str
:returns: The tier.
:raises IndexError: If the tier doesn't exist.
... | def get_tier(self, name_num):
"""Gives a tier, when multiple tiers exist with that name only the
first is returned.
:param name_num: Name or number of the tier to return.
:type name_num: int or str
:returns: The tier.
:raises IndexError: If the tier doesn't exist.
... | [
"Gives",
"a",
"tier",
"when",
"multiple",
"tiers",
"exist",
"with",
"that",
"name",
"only",
"the",
"first",
"is",
"returned",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L180-L190 | [
"def",
"get_tier",
"(",
"self",
",",
"name_num",
")",
":",
"return",
"self",
".",
"tiers",
"[",
"name_num",
"-",
"1",
"]",
"if",
"isinstance",
"(",
"name_num",
",",
"int",
")",
"else",
"[",
"i",
"for",
"i",
"in",
"self",
".",
"tiers",
"if",
"i",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | TextGrid.to_file | Write the object to a file.
:param str filepath: Path of the fil.
:param str codec: Text encoding.
:param string mode: Flag to for write mode, possible modes:
'n'/'normal', 's'/'short' and 'b'/'binary' | pympi/Praat.py | def to_file(self, filepath, codec='utf-8', mode='normal'):
"""Write the object to a file.
:param str filepath: Path of the fil.
:param str codec: Text encoding.
:param string mode: Flag to for write mode, possible modes:
'n'/'normal', 's'/'short' and 'b'/'binary'
"""... | def to_file(self, filepath, codec='utf-8', mode='normal'):
"""Write the object to a file.
:param str filepath: Path of the fil.
:param str codec: Text encoding.
:param string mode: Flag to for write mode, possible modes:
'n'/'normal', 's'/'short' and 'b'/'binary'
"""... | [
"Write",
"the",
"object",
"to",
"a",
"file",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L218-L295 | [
"def",
"to_file",
"(",
"self",
",",
"filepath",
",",
"codec",
"=",
"'utf-8'",
",",
"mode",
"=",
"'normal'",
")",
":",
"self",
".",
"tier_num",
"=",
"len",
"(",
"self",
".",
"tiers",
")",
"if",
"mode",
"in",
"[",
"'binary'",
",",
"'b'",
"]",
":",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | TextGrid.to_eaf | Convert the object to an pympi.Elan.Eaf object
:param int pointlength: Length of respective interval from points in
seconds
:param bool skipempty: Skip the empty annotations
:returns: :class:`pympi.Elan.Eaf` object
:raises ImportError: If the Eaf module c... | pympi/Praat.py | def to_eaf(self, skipempty=True, pointlength=0.1):
"""Convert the object to an pympi.Elan.Eaf object
:param int pointlength: Length of respective interval from points in
seconds
:param bool skipempty: Skip the empty annotations
:returns: :class:`pympi.Ela... | def to_eaf(self, skipempty=True, pointlength=0.1):
"""Convert the object to an pympi.Elan.Eaf object
:param int pointlength: Length of respective interval from points in
seconds
:param bool skipempty: Skip the empty annotations
:returns: :class:`pympi.Ela... | [
"Convert",
"the",
"object",
"to",
"an",
"pympi",
".",
"Elan",
".",
"Eaf",
"object"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L297-L319 | [
"def",
"to_eaf",
"(",
"self",
",",
"skipempty",
"=",
"True",
",",
"pointlength",
"=",
"0.1",
")",
":",
"from",
"pympi",
".",
"Elan",
"import",
"Eaf",
"eaf_out",
"=",
"Eaf",
"(",
")",
"if",
"pointlength",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"'... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Tier.add_point | Add a point to the TextTier
:param int point: Time of the point.
:param str value: Text of the point.
:param bool check: Flag to check for overlap.
:raises Exception: If overlap or wrong tiertype. | pympi/Praat.py | def add_point(self, point, value, check=True):
"""Add a point to the TextTier
:param int point: Time of the point.
:param str value: Text of the point.
:param bool check: Flag to check for overlap.
:raises Exception: If overlap or wrong tiertype.
"""
if self.tier... | def add_point(self, point, value, check=True):
"""Add a point to the TextTier
:param int point: Time of the point.
:param str value: Text of the point.
:param bool check: Flag to check for overlap.
:raises Exception: If overlap or wrong tiertype.
"""
if self.tier... | [
"Add",
"a",
"point",
"to",
"the",
"TextTier"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L348-L360 | [
"def",
"add_point",
"(",
"self",
",",
"point",
",",
"value",
",",
"check",
"=",
"True",
")",
":",
"if",
"self",
".",
"tier_type",
"!=",
"'TextTier'",
":",
"raise",
"Exception",
"(",
"'Tiertype must be TextTier.'",
")",
"if",
"check",
"and",
"any",
"(",
"... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Tier.add_interval | Add an interval to the IntervalTier.
:param float begin: Start time of the interval.
:param float end: End time of the interval.
:param str value: Text of the interval.
:param bool check: Flag to check for overlap.
:raises Exception: If overlap, begin > end or wrong tiertype. | pympi/Praat.py | def add_interval(self, begin, end, value, check=True):
"""Add an interval to the IntervalTier.
:param float begin: Start time of the interval.
:param float end: End time of the interval.
:param str value: Text of the interval.
:param bool check: Flag to check for overlap.
... | def add_interval(self, begin, end, value, check=True):
"""Add an interval to the IntervalTier.
:param float begin: Start time of the interval.
:param float end: End time of the interval.
:param str value: Text of the interval.
:param bool check: Flag to check for overlap.
... | [
"Add",
"an",
"interval",
"to",
"the",
"IntervalTier",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L362-L378 | [
"def",
"add_interval",
"(",
"self",
",",
"begin",
",",
"end",
",",
"value",
",",
"check",
"=",
"True",
")",
":",
"if",
"self",
".",
"tier_type",
"!=",
"'IntervalTier'",
":",
"raise",
"Exception",
"(",
"'Tiertype must be IntervalTier'",
")",
"if",
"check",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Tier.remove_interval | Remove an interval, if no interval is found nothing happens.
:param int time: Time of the interval.
:raises TierTypeException: If the tier is not a IntervalTier. | pympi/Praat.py | def remove_interval(self, time):
"""Remove an interval, if no interval is found nothing happens.
:param int time: Time of the interval.
:raises TierTypeException: If the tier is not a IntervalTier.
"""
if self.tier_type != 'IntervalTier':
raise Exception('Tiertype mu... | def remove_interval(self, time):
"""Remove an interval, if no interval is found nothing happens.
:param int time: Time of the interval.
:raises TierTypeException: If the tier is not a IntervalTier.
"""
if self.tier_type != 'IntervalTier':
raise Exception('Tiertype mu... | [
"Remove",
"an",
"interval",
"if",
"no",
"interval",
"is",
"found",
"nothing",
"happens",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L380-L389 | [
"def",
"remove_interval",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"tier_type",
"!=",
"'IntervalTier'",
":",
"raise",
"Exception",
"(",
"'Tiertype must be IntervalTier.'",
")",
"self",
".",
"intervals",
"=",
"[",
"i",
"for",
"i",
"in",
"self",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Tier.remove_point | Remove a point, if no point is found nothing happens.
:param int time: Time of the point.
:raises TierTypeException: If the tier is not a TextTier. | pympi/Praat.py | def remove_point(self, time):
"""Remove a point, if no point is found nothing happens.
:param int time: Time of the point.
:raises TierTypeException: If the tier is not a TextTier.
"""
if self.tier_type != 'TextTier':
raise Exception('Tiertype must be TextTier.')
... | def remove_point(self, time):
"""Remove a point, if no point is found nothing happens.
:param int time: Time of the point.
:raises TierTypeException: If the tier is not a TextTier.
"""
if self.tier_type != 'TextTier':
raise Exception('Tiertype must be TextTier.')
... | [
"Remove",
"a",
"point",
"if",
"no",
"point",
"is",
"found",
"nothing",
"happens",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L391-L399 | [
"def",
"remove_point",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"tier_type",
"!=",
"'TextTier'",
":",
"raise",
"Exception",
"(",
"'Tiertype must be TextTier.'",
")",
"self",
".",
"intervals",
"=",
"[",
"i",
"for",
"i",
"in",
"self",
".",
"i... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Tier.get_intervals | Give all the intervals or points.
:param bool sort: Flag for yielding the intervals or points sorted.
:yields: All the intervals | pympi/Praat.py | def get_intervals(self, sort=False):
"""Give all the intervals or points.
:param bool sort: Flag for yielding the intervals or points sorted.
:yields: All the intervals
"""
for i in sorted(self.intervals) if sort else self.intervals:
yield i | def get_intervals(self, sort=False):
"""Give all the intervals or points.
:param bool sort: Flag for yielding the intervals or points sorted.
:yields: All the intervals
"""
for i in sorted(self.intervals) if sort else self.intervals:
yield i | [
"Give",
"all",
"the",
"intervals",
"or",
"points",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L401-L408 | [
"def",
"get_intervals",
"(",
"self",
",",
"sort",
"=",
"False",
")",
":",
"for",
"i",
"in",
"sorted",
"(",
"self",
".",
"intervals",
")",
"if",
"sort",
"else",
"self",
".",
"intervals",
":",
"yield",
"i"
] | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Tier.get_all_intervals | Returns the true list of intervals including the empty intervals. | pympi/Praat.py | def get_all_intervals(self):
"""Returns the true list of intervals including the empty intervals."""
ints = sorted(self.get_intervals(True))
if self.tier_type == 'IntervalTier':
if not ints:
ints.append((self.xmin, self.xmax, ''))
else:
if ... | def get_all_intervals(self):
"""Returns the true list of intervals including the empty intervals."""
ints = sorted(self.get_intervals(True))
if self.tier_type == 'IntervalTier':
if not ints:
ints.append((self.xmin, self.xmax, ''))
else:
if ... | [
"Returns",
"the",
"true",
"list",
"of",
"intervals",
"including",
"the",
"empty",
"intervals",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L414-L430 | [
"def",
"get_all_intervals",
"(",
"self",
")",
":",
"ints",
"=",
"sorted",
"(",
"self",
".",
"get_intervals",
"(",
"True",
")",
")",
"if",
"self",
".",
"tier_type",
"==",
"'IntervalTier'",
":",
"if",
"not",
"ints",
":",
"ints",
".",
"append",
"(",
"(",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | eaf_from_chat | Reads a .cha file and converts it to an elan object. The functions tries
to mimic the CHAT2ELAN program that comes with the CLAN package as close as
possible. This function however converts to the latest ELAN file format
since the library is designed for it. All CHAT headers will be added as
Properties ... | pympi/Elan.py | def eaf_from_chat(file_path, codec='ascii', extension='wav'):
"""Reads a .cha file and converts it to an elan object. The functions tries
to mimic the CHAT2ELAN program that comes with the CLAN package as close as
possible. This function however converts to the latest ELAN file format
since the library ... | def eaf_from_chat(file_path, codec='ascii', extension='wav'):
"""Reads a .cha file and converts it to an elan object. The functions tries
to mimic the CHAT2ELAN program that comes with the CLAN package as close as
possible. This function however converts to the latest ELAN file format
since the library ... | [
"Reads",
"a",
".",
"cha",
"file",
"and",
"converts",
"it",
"to",
"an",
"elan",
"object",
".",
"The",
"functions",
"tries",
"to",
"mimic",
"the",
"CHAT2ELAN",
"program",
"that",
"comes",
"with",
"the",
"CLAN",
"package",
"as",
"close",
"as",
"possible",
"... | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L1358-L1433 | [
"def",
"eaf_from_chat",
"(",
"file_path",
",",
"codec",
"=",
"'ascii'",
",",
"extension",
"=",
"'wav'",
")",
":",
"eafob",
"=",
"Eaf",
"(",
")",
"eafob",
".",
"add_linguistic_type",
"(",
"'parent'",
")",
"eafob",
".",
"add_linguistic_type",
"(",
"'child'",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | parse_eaf | Parse an EAF file
:param str file_path: Path to read from, - for stdin.
:param pympi.Elan.Eaf eaf_obj: Existing EAF object to put the data in.
:returns: EAF object. | pympi/Elan.py | def parse_eaf(file_path, eaf_obj):
"""Parse an EAF file
:param str file_path: Path to read from, - for stdin.
:param pympi.Elan.Eaf eaf_obj: Existing EAF object to put the data in.
:returns: EAF object.
"""
if file_path == '-':
file_path = sys.stdin
# Annotation document
try:
... | def parse_eaf(file_path, eaf_obj):
"""Parse an EAF file
:param str file_path: Path to read from, - for stdin.
:param pympi.Elan.Eaf eaf_obj: Existing EAF object to put the data in.
:returns: EAF object.
"""
if file_path == '-':
file_path = sys.stdin
# Annotation document
try:
... | [
"Parse",
"an",
"EAF",
"file"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L1436-L1577 | [
"def",
"parse_eaf",
"(",
"file_path",
",",
"eaf_obj",
")",
":",
"if",
"file_path",
"==",
"'-'",
":",
"file_path",
"=",
"sys",
".",
"stdin",
"# Annotation document",
"try",
":",
"tree_root",
"=",
"etree",
".",
"parse",
"(",
"file_path",
")",
".",
"getroot",... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | indent | Function to pretty print the xml, meaning adding tabs and newlines.
:param ElementTree.Element el: Current element.
:param int level: Current level. | pympi/Elan.py | def indent(el, level=0):
"""Function to pretty print the xml, meaning adding tabs and newlines.
:param ElementTree.Element el: Current element.
:param int level: Current level.
"""
i = '\n' + level * '\t'
if len(el):
if not el.text or not el.text.strip():
el.text = i+'\t'
... | def indent(el, level=0):
"""Function to pretty print the xml, meaning adding tabs and newlines.
:param ElementTree.Element el: Current element.
:param int level: Current level.
"""
i = '\n' + level * '\t'
if len(el):
if not el.text or not el.text.strip():
el.text = i+'\t'
... | [
"Function",
"to",
"pretty",
"print",
"the",
"xml",
"meaning",
"adding",
"tabs",
"and",
"newlines",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L1580-L1598 | [
"def",
"indent",
"(",
"el",
",",
"level",
"=",
"0",
")",
":",
"i",
"=",
"'\\n'",
"+",
"level",
"*",
"'\\t'",
"if",
"len",
"(",
"el",
")",
":",
"if",
"not",
"el",
".",
"text",
"or",
"not",
"el",
".",
"text",
".",
"strip",
"(",
")",
":",
"el"... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | to_eaf | Write an Eaf object to file.
:param str file_path: Filepath to write to, - for stdout.
:param pympi.Elan.Eaf eaf_obj: Object to write.
:param bool pretty: Flag to set pretty printing. | pympi/Elan.py | def to_eaf(file_path, eaf_obj, pretty=True):
"""Write an Eaf object to file.
:param str file_path: Filepath to write to, - for stdout.
:param pympi.Elan.Eaf eaf_obj: Object to write.
:param bool pretty: Flag to set pretty printing.
"""
def rm_none(x):
try: # Ugly hack to test if s is a... | def to_eaf(file_path, eaf_obj, pretty=True):
"""Write an Eaf object to file.
:param str file_path: Filepath to write to, - for stdout.
:param pympi.Elan.Eaf eaf_obj: Object to write.
:param bool pretty: Flag to set pretty printing.
"""
def rm_none(x):
try: # Ugly hack to test if s is a... | [
"Write",
"an",
"Eaf",
"object",
"to",
"file",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L1601-L1706 | [
"def",
"to_eaf",
"(",
"file_path",
",",
"eaf_obj",
",",
"pretty",
"=",
"True",
")",
":",
"def",
"rm_none",
"(",
"x",
")",
":",
"try",
":",
"# Ugly hack to test if s is a string in py3 and py2",
"basestring",
"def",
"isstr",
"(",
"s",
")",
":",
"return",
"isi... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_annotation | Add an annotation.
:param str id_tier: Name of the tier.
:param int start: Start time of the annotation.
:param int end: End time of the annotation.
:param str value: Value of the annotation.
:param str svg_ref: Svg reference.
:raises KeyError: If the tier is non existen... | pympi/Elan.py | def add_annotation(self, id_tier, start, end, value='', svg_ref=None):
"""Add an annotation.
:param str id_tier: Name of the tier.
:param int start: Start time of the annotation.
:param int end: End time of the annotation.
:param str value: Value of the annotation.
:para... | def add_annotation(self, id_tier, start, end, value='', svg_ref=None):
"""Add an annotation.
:param str id_tier: Name of the tier.
:param int start: Start time of the annotation.
:param int end: End time of the annotation.
:param str value: Value of the annotation.
:para... | [
"Add",
"an",
"annotation",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L118-L143 | [
"def",
"add_annotation",
"(",
"self",
",",
"id_tier",
",",
"start",
",",
"end",
",",
"value",
"=",
"''",
",",
"svg_ref",
"=",
"None",
")",
":",
"if",
"self",
".",
"tiers",
"[",
"id_tier",
"]",
"[",
"1",
"]",
":",
"raise",
"ValueError",
"(",
"'Tier ... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_cv_entry | Add an entry to a controlled vocabulary.
:param str cv_id: Name of the controlled vocabulary to add an entry.
:param str cve_id: Name of the entry.
:param list values: List of values of the form:
``(value, lang_ref, description)`` where description can be
``None``.
... | pympi/Elan.py | def add_cv_entry(self, cv_id, cve_id, values, ext_ref=None):
"""Add an entry to a controlled vocabulary.
:param str cv_id: Name of the controlled vocabulary to add an entry.
:param str cve_id: Name of the entry.
:param list values: List of values of the form:
``(value, lang_... | def add_cv_entry(self, cv_id, cve_id, values, ext_ref=None):
"""Add an entry to a controlled vocabulary.
:param str cv_id: Name of the controlled vocabulary to add an entry.
:param str cve_id: Name of the entry.
:param list values: List of values of the form:
``(value, lang_... | [
"Add",
"an",
"entry",
"to",
"a",
"controlled",
"vocabulary",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L154-L169 | [
"def",
"add_cv_entry",
"(",
"self",
",",
"cv_id",
",",
"cve_id",
",",
"values",
",",
"ext_ref",
"=",
"None",
")",
":",
"for",
"value",
",",
"lang_ref",
",",
"description",
"in",
"values",
":",
"if",
"lang_ref",
"not",
"in",
"self",
".",
"languages",
":... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_cv_description | Add a description to a controlled vocabulary.
:param str cv_id: Name of the controlled vocabulary to add the
description.
:param str lang_ref: Language reference.
:param str description: Description, this can be none.
:throws KeyError: If there is no controlled vocabulary wi... | pympi/Elan.py | def add_cv_description(self, cv_id, lang_ref, description=None):
"""Add a description to a controlled vocabulary.
:param str cv_id: Name of the controlled vocabulary to add the
description.
:param str lang_ref: Language reference.
:param str description: Description, this ca... | def add_cv_description(self, cv_id, lang_ref, description=None):
"""Add a description to a controlled vocabulary.
:param str cv_id: Name of the controlled vocabulary to add the
description.
:param str lang_ref: Language reference.
:param str description: Description, this ca... | [
"Add",
"a",
"description",
"to",
"a",
"controlled",
"vocabulary",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L171-L183 | [
"def",
"add_cv_description",
"(",
"self",
",",
"cv_id",
",",
"lang_ref",
",",
"description",
"=",
"None",
")",
":",
"if",
"lang_ref",
"not",
"in",
"self",
".",
"languages",
":",
"raise",
"ValueError",
"(",
"'Language not present: {}'",
".",
"format",
"(",
"l... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_external_ref | Add an external reference.
:param str eid: Name of the external reference.
:param str etype: Type of the external reference, has to be in
``['iso12620', 'ecv', 'cve_id', 'lexen_id', 'resource_url']``.
:param str value: Value of the external reference.
:throws KeyError: if et... | pympi/Elan.py | def add_external_ref(self, eid, etype, value):
"""Add an external reference.
:param str eid: Name of the external reference.
:param str etype: Type of the external reference, has to be in
``['iso12620', 'ecv', 'cve_id', 'lexen_id', 'resource_url']``.
:param str value: Value ... | def add_external_ref(self, eid, etype, value):
"""Add an external reference.
:param str eid: Name of the external reference.
:param str etype: Type of the external reference, has to be in
``['iso12620', 'ecv', 'cve_id', 'lexen_id', 'resource_url']``.
:param str value: Value ... | [
"Add",
"an",
"external",
"reference",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L185-L196 | [
"def",
"add_external_ref",
"(",
"self",
",",
"eid",
",",
"etype",
",",
"value",
")",
":",
"if",
"etype",
"not",
"in",
"self",
".",
"ETYPES",
":",
"raise",
"KeyError",
"(",
"'etype not in {}'",
".",
"format",
"(",
"self",
".",
"ETYPES",
")",
")",
"self"... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_language | Add a language.
:param str lang_id: ID of the language.
:param str lang_def: Definition of the language(preferably ISO-639-3).
:param str lang_label: Label of the language. | pympi/Elan.py | def add_language(self, lang_id, lang_def=None, lang_label=None):
"""Add a language.
:param str lang_id: ID of the language.
:param str lang_def: Definition of the language(preferably ISO-639-3).
:param str lang_label: Label of the language.
"""
self.languages[lang_id] = ... | def add_language(self, lang_id, lang_def=None, lang_label=None):
"""Add a language.
:param str lang_id: ID of the language.
:param str lang_def: Definition of the language(preferably ISO-639-3).
:param str lang_label: Label of the language.
"""
self.languages[lang_id] = ... | [
"Add",
"a",
"language",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L198-L205 | [
"def",
"add_language",
"(",
"self",
",",
"lang_id",
",",
"lang_def",
"=",
"None",
",",
"lang_label",
"=",
"None",
")",
":",
"self",
".",
"languages",
"[",
"lang_id",
"]",
"=",
"(",
"lang_def",
",",
"lang_label",
")"
] | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_lexicon_ref | Add lexicon reference.
:param str lrid: Lexicon reference internal ID.
:param str name: Lexicon reference display name.
:param str lrtype: Lexicon reference service type.
:param str url: Lexicon reference service location
:param str lexicon_id: Lexicon reference service id.
... | pympi/Elan.py | def add_lexicon_ref(self, lrid, name, lrtype, url, lexicon_id,
lexicon_name, datcat_id=None, datcat_name=None):
"""Add lexicon reference.
:param str lrid: Lexicon reference internal ID.
:param str name: Lexicon reference display name.
:param str lrtype: Lexicon r... | def add_lexicon_ref(self, lrid, name, lrtype, url, lexicon_id,
lexicon_name, datcat_id=None, datcat_name=None):
"""Add lexicon reference.
:param str lrid: Lexicon reference internal ID.
:param str name: Lexicon reference display name.
:param str lrtype: Lexicon r... | [
"Add",
"lexicon",
"reference",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L207-L229 | [
"def",
"add_lexicon_ref",
"(",
"self",
",",
"lrid",
",",
"name",
",",
"lrtype",
",",
"url",
",",
"lexicon_id",
",",
"lexicon_name",
",",
"datcat_id",
"=",
"None",
",",
"datcat_name",
"=",
"None",
")",
":",
"self",
".",
"lexicon_refs",
"[",
"lrid",
"]",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_linguistic_type | Add a linguistic type.
:param str lingtype: Name of the linguistic type.
:param str constraints: Constraint name.
:param bool timealignable: Flag for time alignable.
:param bool graphicreferences: Flag for graphic references.
:param str extref: External reference.
:param... | pympi/Elan.py | def add_linguistic_type(self, lingtype, constraints=None,
timealignable=True, graphicreferences=False,
extref=None, param_dict=None):
"""Add a linguistic type.
:param str lingtype: Name of the linguistic type.
:param str constraints: Const... | def add_linguistic_type(self, lingtype, constraints=None,
timealignable=True, graphicreferences=False,
extref=None, param_dict=None):
"""Add a linguistic type.
:param str lingtype: Name of the linguistic type.
:param str constraints: Const... | [
"Add",
"a",
"linguistic",
"type",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L239-L266 | [
"def",
"add_linguistic_type",
"(",
"self",
",",
"lingtype",
",",
"constraints",
"=",
"None",
",",
"timealignable",
"=",
"True",
",",
"graphicreferences",
"=",
"False",
",",
"extref",
"=",
"None",
",",
"param_dict",
"=",
"None",
")",
":",
"if",
"param_dict",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_linked_file | Add a linked file.
:param str file_path: Path of the file.
:param str relpath: Relative path of the file.
:param str mimetype: Mimetype of the file, if ``None`` it tries to
guess it according to the file extension which currently only works
for wav, mpg, mpeg and xml.
... | pympi/Elan.py | def add_linked_file(self, file_path, relpath=None, mimetype=None,
time_origin=None, ex_from=None):
"""Add a linked file.
:param str file_path: Path of the file.
:param str relpath: Relative path of the file.
:param str mimetype: Mimetype of the file, if ``None`` ... | def add_linked_file(self, file_path, relpath=None, mimetype=None,
time_origin=None, ex_from=None):
"""Add a linked file.
:param str file_path: Path of the file.
:param str relpath: Relative path of the file.
:param str mimetype: Mimetype of the file, if ``None`` ... | [
"Add",
"a",
"linked",
"file",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L268-L287 | [
"def",
"add_linked_file",
"(",
"self",
",",
"file_path",
",",
"relpath",
"=",
"None",
",",
"mimetype",
"=",
"None",
",",
"time_origin",
"=",
"None",
",",
"ex_from",
"=",
"None",
")",
":",
"if",
"mimetype",
"is",
"None",
":",
"mimetype",
"=",
"self",
".... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_locale | Add a locale.
:param str language_code: The language code of the locale.
:param str country_code: The country code of the locale.
:param str variant: The variant of the locale. | pympi/Elan.py | def add_locale(self, language_code, country_code=None, variant=None):
"""Add a locale.
:param str language_code: The language code of the locale.
:param str country_code: The country code of the locale.
:param str variant: The variant of the locale.
"""
self.locales[lang... | def add_locale(self, language_code, country_code=None, variant=None):
"""Add a locale.
:param str language_code: The language code of the locale.
:param str country_code: The country code of the locale.
:param str variant: The variant of the locale.
"""
self.locales[lang... | [
"Add",
"a",
"locale",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L289-L296 | [
"def",
"add_locale",
"(",
"self",
",",
"language_code",
",",
"country_code",
"=",
"None",
",",
"variant",
"=",
"None",
")",
":",
"self",
".",
"locales",
"[",
"language_code",
"]",
"=",
"(",
"country_code",
",",
"variant",
")"
] | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_ref_annotation | Add a reference annotation.
.. note:: When a timepoint matches two annotations the new reference
annotation will reference to the first annotation. To circumvent this
it's always safer to take the middle of the annotation you want to
reference to.
:param str id_tier: Name of the... | pympi/Elan.py | def add_ref_annotation(self, id_tier, tier2, time, value='',
prev=None, svg=None):
"""Add a reference annotation.
.. note:: When a timepoint matches two annotations the new reference
annotation will reference to the first annotation. To circumvent this
it's alw... | def add_ref_annotation(self, id_tier, tier2, time, value='',
prev=None, svg=None):
"""Add a reference annotation.
.. note:: When a timepoint matches two annotations the new reference
annotation will reference to the first annotation. To circumvent this
it's alw... | [
"Add",
"a",
"reference",
"annotation",
".",
"..",
"note",
"::",
"When",
"a",
"timepoint",
"matches",
"two",
"annotations",
"the",
"new",
"reference",
"annotation",
"will",
"reference",
"to",
"the",
"first",
"annotation",
".",
"To",
"circumvent",
"this",
"it",
... | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L306-L337 | [
"def",
"add_ref_annotation",
"(",
"self",
",",
"id_tier",
",",
"tier2",
",",
"time",
",",
"value",
"=",
"''",
",",
"prev",
"=",
"None",
",",
"svg",
"=",
"None",
")",
":",
"if",
"self",
".",
"tiers",
"[",
"id_tier",
"]",
"[",
"0",
"]",
":",
"raise... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_secondary_linked_file | Add a secondary linked file.
:param str file_path: Path of the file.
:param str relpath: Relative path of the file.
:param str mimetype: Mimetype of the file, if ``None`` it tries to
guess it according to the file extension which currently only works
for wav, mpg, mpeg a... | pympi/Elan.py | def add_secondary_linked_file(self, file_path, relpath=None, mimetype=None,
time_origin=None, assoc_with=None):
"""Add a secondary linked file.
:param str file_path: Path of the file.
:param str relpath: Relative path of the file.
:param str mimetype: M... | def add_secondary_linked_file(self, file_path, relpath=None, mimetype=None,
time_origin=None, assoc_with=None):
"""Add a secondary linked file.
:param str file_path: Path of the file.
:param str relpath: Relative path of the file.
:param str mimetype: M... | [
"Add",
"a",
"secondary",
"linked",
"file",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L339-L358 | [
"def",
"add_secondary_linked_file",
"(",
"self",
",",
"file_path",
",",
"relpath",
"=",
"None",
",",
"mimetype",
"=",
"None",
",",
"time_origin",
"=",
"None",
",",
"assoc_with",
"=",
"None",
")",
":",
"if",
"mimetype",
"is",
"None",
":",
"mimetype",
"=",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.add_tier | Add a tier. When no linguistic type is given and the default
linguistic type is unavailable then the assigned linguistic type will
be the first in the list.
:param str tier_id: Name of the tier.
:param str ling: Linguistic type, if the type is not available it will
... | pympi/Elan.py | def add_tier(self, tier_id, ling='default-lt', parent=None, locale=None,
part=None, ann=None, language=None, tier_dict=None):
"""Add a tier. When no linguistic type is given and the default
linguistic type is unavailable then the assigned linguistic type will
be the first in the... | def add_tier(self, tier_id, ling='default-lt', parent=None, locale=None,
part=None, ann=None, language=None, tier_dict=None):
"""Add a tier. When no linguistic type is given and the default
linguistic type is unavailable then the assigned linguistic type will
be the first in the... | [
"Add",
"a",
"tier",
".",
"When",
"no",
"linguistic",
"type",
"is",
"given",
"and",
"the",
"default",
"linguistic",
"type",
"is",
"unavailable",
"then",
"the",
"assigned",
"linguistic",
"type",
"will",
"be",
"the",
"first",
"in",
"the",
"list",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L360-L400 | [
"def",
"add_tier",
"(",
"self",
",",
"tier_id",
",",
"ling",
"=",
"'default-lt'",
",",
"parent",
"=",
"None",
",",
"locale",
"=",
"None",
",",
"part",
"=",
"None",
",",
"ann",
"=",
"None",
",",
"language",
"=",
"None",
",",
"tier_dict",
"=",
"None",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.clean_time_slots | Clean up all unused timeslots.
.. warning:: This can and will take time for larger tiers.
When you want to do a lot of operations on a lot of tiers please unset
the flags for cleaning in the functions so that the cleaning is only
performed afterwards. | pympi/Elan.py | def clean_time_slots(self):
"""Clean up all unused timeslots.
.. warning:: This can and will take time for larger tiers.
When you want to do a lot of operations on a lot of tiers please unset
the flags for cleaning in the functions so that the cleaning is only
performed afterwa... | def clean_time_slots(self):
"""Clean up all unused timeslots.
.. warning:: This can and will take time for larger tiers.
When you want to do a lot of operations on a lot of tiers please unset
the flags for cleaning in the functions so that the cleaning is only
performed afterwa... | [
"Clean",
"up",
"all",
"unused",
"timeslots",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L409-L420 | [
"def",
"clean_time_slots",
"(",
"self",
")",
":",
"ts",
"=",
"(",
"(",
"a",
"[",
"0",
"]",
",",
"a",
"[",
"1",
"]",
")",
"for",
"t",
"in",
"self",
".",
"tiers",
".",
"values",
"(",
")",
"for",
"a",
"in",
"t",
"[",
"0",
"]",
".",
"values",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.copy_tier | Copies a tier to another :class:`pympi.Elan.Eaf` object.
:param pympi.Elan.Eaf eaf_obj: Target Eaf object.
:param str tier_name: Name of the tier.
:raises KeyError: If the tier doesn't exist. | pympi/Elan.py | def copy_tier(self, eaf_obj, tier_name):
"""Copies a tier to another :class:`pympi.Elan.Eaf` object.
:param pympi.Elan.Eaf eaf_obj: Target Eaf object.
:param str tier_name: Name of the tier.
:raises KeyError: If the tier doesn't exist.
"""
if tier_name in eaf_obj.get_tie... | def copy_tier(self, eaf_obj, tier_name):
"""Copies a tier to another :class:`pympi.Elan.Eaf` object.
:param pympi.Elan.Eaf eaf_obj: Target Eaf object.
:param str tier_name: Name of the tier.
:raises KeyError: If the tier doesn't exist.
"""
if tier_name in eaf_obj.get_tie... | [
"Copies",
"a",
"tier",
"to",
"another",
":",
"class",
":",
"pympi",
".",
"Elan",
".",
"Eaf",
"object",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L422-L434 | [
"def",
"copy_tier",
"(",
"self",
",",
"eaf_obj",
",",
"tier_name",
")",
":",
"if",
"tier_name",
"in",
"eaf_obj",
".",
"get_tier_names",
"(",
")",
":",
"eaf_obj",
".",
"remove_tier",
"(",
"tier_name",
")",
"eaf_obj",
".",
"add_tier",
"(",
"tier_name",
",",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.create_gaps_and_overlaps_tier | Create a tier with the gaps and overlaps of the annotations.
For types see :func:`get_gaps_and_overlaps`
:param str tier1: Name of the first tier.
:param str tier2: Name of the second tier.
:param str tier_name: Name of the new tier, if ``None`` the name will
... | pympi/Elan.py | def create_gaps_and_overlaps_tier(self, tier1, tier2, tier_name=None,
maxlen=-1, fast=False):
"""Create a tier with the gaps and overlaps of the annotations.
For types see :func:`get_gaps_and_overlaps`
:param str tier1: Name of the first tier.
:para... | def create_gaps_and_overlaps_tier(self, tier1, tier2, tier_name=None,
maxlen=-1, fast=False):
"""Create a tier with the gaps and overlaps of the annotations.
For types see :func:`get_gaps_and_overlaps`
:param str tier1: Name of the first tier.
:para... | [
"Create",
"a",
"tier",
"with",
"the",
"gaps",
"and",
"overlaps",
"of",
"the",
"annotations",
".",
"For",
"types",
"see",
":",
"func",
":",
"get_gaps_and_overlaps"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L436-L464 | [
"def",
"create_gaps_and_overlaps_tier",
"(",
"self",
",",
"tier1",
",",
"tier2",
",",
"tier_name",
"=",
"None",
",",
"maxlen",
"=",
"-",
"1",
",",
"fast",
"=",
"False",
")",
":",
"if",
"tier_name",
"is",
"None",
":",
"tier_name",
"=",
"'{}_{}_ftos'",
"."... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.extract | Extracts the selected time frame as a new object.
:param int start: Start time.
:param int end: End time.
:returns: class:`pympi.Elan.Eaf` object containing the extracted frame. | pympi/Elan.py | def extract(self, start, end):
"""Extracts the selected time frame as a new object.
:param int start: Start time.
:param int end: End time.
:returns: class:`pympi.Elan.Eaf` object containing the extracted frame.
"""
from copy import deepcopy
eaf_out = deepcopy(se... | def extract(self, start, end):
"""Extracts the selected time frame as a new object.
:param int start: Start time.
:param int end: End time.
:returns: class:`pympi.Elan.Eaf` object containing the extracted frame.
"""
from copy import deepcopy
eaf_out = deepcopy(se... | [
"Extracts",
"the",
"selected",
"time",
"frame",
"as",
"a",
"new",
"object",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L466-L480 | [
"def",
"extract",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"from",
"copy",
"import",
"deepcopy",
"eaf_out",
"=",
"deepcopy",
"(",
"self",
")",
"for",
"t",
"in",
"eaf_out",
".",
"get_tier_names",
"(",
")",
":",
"for",
"ab",
",",
"ae",
",",
"... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.filter_annotations | Filter annotations in a tier using an exclusive and/or inclusive
filter.
:param str tier: Name of the tier.
:param str tier_name: Name of the output tier, when ``None`` the name
will be generated.
:param list filtin: List of strings to be included, if None all
an... | pympi/Elan.py | def filter_annotations(self, tier, tier_name=None, filtin=None,
filtex=None, regex=False, safe=False):
"""Filter annotations in a tier using an exclusive and/or inclusive
filter.
:param str tier: Name of the tier.
:param str tier_name: Name of the output tier,... | def filter_annotations(self, tier, tier_name=None, filtin=None,
filtex=None, regex=False, safe=False):
"""Filter annotations in a tier using an exclusive and/or inclusive
filter.
:param str tier: Name of the tier.
:param str tier_name: Name of the output tier,... | [
"Filter",
"annotations",
"in",
"a",
"tier",
"using",
"an",
"exclusive",
"and",
"/",
"or",
"inclusive",
"filter",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L482-L512 | [
"def",
"filter_annotations",
"(",
"self",
",",
"tier",
",",
"tier_name",
"=",
"None",
",",
"filtin",
"=",
"None",
",",
"filtex",
"=",
"None",
",",
"regex",
"=",
"False",
",",
"safe",
"=",
"False",
")",
":",
"if",
"tier_name",
"is",
"None",
":",
"tier... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.generate_annotation_id | Generate the next annotation id, this function is mainly used
internally. | pympi/Elan.py | def generate_annotation_id(self):
"""Generate the next annotation id, this function is mainly used
internally.
"""
if not self.maxaid:
valid_anns = [int(''.join(filter(str.isdigit, a)))
for a in self.timeslots]
self.maxaid = max(valid_ann... | def generate_annotation_id(self):
"""Generate the next annotation id, this function is mainly used
internally.
"""
if not self.maxaid:
valid_anns = [int(''.join(filter(str.isdigit, a)))
for a in self.timeslots]
self.maxaid = max(valid_ann... | [
"Generate",
"the",
"next",
"annotation",
"id",
"this",
"function",
"is",
"mainly",
"used",
"internally",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L514-L524 | [
"def",
"generate_annotation_id",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"maxaid",
":",
"valid_anns",
"=",
"[",
"int",
"(",
"''",
".",
"join",
"(",
"filter",
"(",
"str",
".",
"isdigit",
",",
"a",
")",
")",
")",
"for",
"a",
"in",
"self",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.generate_ts_id | Generate the next timeslot id, this function is mainly used
internally
:param int time: Initial time to assign to the timeslot.
:raises ValueError: If the time is negative. | pympi/Elan.py | def generate_ts_id(self, time=None):
"""Generate the next timeslot id, this function is mainly used
internally
:param int time: Initial time to assign to the timeslot.
:raises ValueError: If the time is negative.
"""
if time and time < 0:
raise ValueError('Ti... | def generate_ts_id(self, time=None):
"""Generate the next timeslot id, this function is mainly used
internally
:param int time: Initial time to assign to the timeslot.
:raises ValueError: If the time is negative.
"""
if time and time < 0:
raise ValueError('Ti... | [
"Generate",
"the",
"next",
"timeslot",
"id",
"this",
"function",
"is",
"mainly",
"used",
"internally"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L526-L543 | [
"def",
"generate_ts_id",
"(",
"self",
",",
"time",
"=",
"None",
")",
":",
"if",
"time",
"and",
"time",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'Time is negative...'",
")",
"if",
"not",
"self",
".",
"maxts",
":",
"valid_ts",
"=",
"[",
"int",
"(",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_annotation_data_at_time | Give the annotations at the given time. When the tier contains
reference annotations this will be returned, check
:func:`get_ref_annotation_data_at_time` for the format.
:param str id_tier: Name of the tier.
:param int time: Time of the annotation.
:returns: List of annotations ... | pympi/Elan.py | def get_annotation_data_at_time(self, id_tier, time):
"""Give the annotations at the given time. When the tier contains
reference annotations this will be returned, check
:func:`get_ref_annotation_data_at_time` for the format.
:param str id_tier: Name of the tier.
:param int tim... | def get_annotation_data_at_time(self, id_tier, time):
"""Give the annotations at the given time. When the tier contains
reference annotations this will be returned, check
:func:`get_ref_annotation_data_at_time` for the format.
:param str id_tier: Name of the tier.
:param int tim... | [
"Give",
"the",
"annotations",
"at",
"the",
"given",
"time",
".",
"When",
"the",
"tier",
"contains",
"reference",
"annotations",
"this",
"will",
"be",
"returned",
"check",
":",
"func",
":",
"get_ref_annotation_data_at_time",
"for",
"the",
"format",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L545-L561 | [
"def",
"get_annotation_data_at_time",
"(",
"self",
",",
"id_tier",
",",
"time",
")",
":",
"if",
"self",
".",
"tiers",
"[",
"id_tier",
"]",
"[",
"1",
"]",
":",
"return",
"self",
".",
"get_ref_annotation_at_time",
"(",
"id_tier",
",",
"time",
")",
"anns",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_annotation_data_after_time | Give the annotation before a given time. When the tier contains
reference annotations this will be returned, check
:func:`get_ref_annotation_data_before_time` for the format. If an
annotation overlaps with ``time`` that annotation will be returned.
:param str id_tier: Name of the tier.
... | pympi/Elan.py | def get_annotation_data_after_time(self, id_tier, time):
"""Give the annotation before a given time. When the tier contains
reference annotations this will be returned, check
:func:`get_ref_annotation_data_before_time` for the format. If an
annotation overlaps with ``time`` that annotati... | def get_annotation_data_after_time(self, id_tier, time):
"""Give the annotation before a given time. When the tier contains
reference annotations this will be returned, check
:func:`get_ref_annotation_data_before_time` for the format. If an
annotation overlaps with ``time`` that annotati... | [
"Give",
"the",
"annotation",
"before",
"a",
"given",
"time",
".",
"When",
"the",
"tier",
"contains",
"reference",
"annotations",
"this",
"will",
"be",
"returned",
"check",
":",
"func",
":",
"get_ref_annotation_data_before_time",
"for",
"the",
"format",
".",
"If"... | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L563-L580 | [
"def",
"get_annotation_data_after_time",
"(",
"self",
",",
"id_tier",
",",
"time",
")",
":",
"if",
"self",
".",
"tiers",
"[",
"id_tier",
"]",
"[",
"1",
"]",
":",
"return",
"self",
".",
"get_ref_annotation_after_time",
"(",
"id_tier",
",",
"time",
")",
"bef... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_annotation_data_before_time | Give the annotation before a given time. When the tier contains
reference annotations this will be returned, check
:func:`get_ref_annotation_data_before_time` for the format. If an
annotation overlaps with ``time`` that annotation will be returned.
:param str id_tier: Name of the tier.
... | pympi/Elan.py | def get_annotation_data_before_time(self, id_tier, time):
"""Give the annotation before a given time. When the tier contains
reference annotations this will be returned, check
:func:`get_ref_annotation_data_before_time` for the format. If an
annotation overlaps with ``time`` that annotat... | def get_annotation_data_before_time(self, id_tier, time):
"""Give the annotation before a given time. When the tier contains
reference annotations this will be returned, check
:func:`get_ref_annotation_data_before_time` for the format. If an
annotation overlaps with ``time`` that annotat... | [
"Give",
"the",
"annotation",
"before",
"a",
"given",
"time",
".",
"When",
"the",
"tier",
"contains",
"reference",
"annotations",
"this",
"will",
"be",
"returned",
"check",
":",
"func",
":",
"get_ref_annotation_data_before_time",
"for",
"the",
"format",
".",
"If"... | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L582-L598 | [
"def",
"get_annotation_data_before_time",
"(",
"self",
",",
"id_tier",
",",
"time",
")",
":",
"if",
"self",
".",
"tiers",
"[",
"id_tier",
"]",
"[",
"1",
"]",
":",
"return",
"self",
".",
"get_ref_annotation_before_time",
"(",
"id_tier",
",",
"time",
")",
"b... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_annotation_data_between_times | Gives the annotations within the times.
When the tier contains reference annotations this will be returned,
check :func:`get_ref_annotation_data_between_times` for the format.
:param str id_tier: Name of the tier.
:param int start: Start time of the annotation.
:param int end: E... | pympi/Elan.py | def get_annotation_data_between_times(self, id_tier, start, end):
"""Gives the annotations within the times.
When the tier contains reference annotations this will be returned,
check :func:`get_ref_annotation_data_between_times` for the format.
:param str id_tier: Name of the tier.
... | def get_annotation_data_between_times(self, id_tier, start, end):
"""Gives the annotations within the times.
When the tier contains reference annotations this will be returned,
check :func:`get_ref_annotation_data_between_times` for the format.
:param str id_tier: Name of the tier.
... | [
"Gives",
"the",
"annotations",
"within",
"the",
"times",
".",
"When",
"the",
"tier",
"contains",
"reference",
"annotations",
"this",
"will",
"be",
"returned",
"check",
":",
"func",
":",
"get_ref_annotation_data_between_times",
"for",
"the",
"format",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L600-L616 | [
"def",
"get_annotation_data_between_times",
"(",
"self",
",",
"id_tier",
",",
"start",
",",
"end",
")",
":",
"if",
"self",
".",
"tiers",
"[",
"id_tier",
"]",
"[",
"1",
"]",
":",
"return",
"self",
".",
"get_ref_annotation_data_between_times",
"(",
"id_tier",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_annotation_data_for_tier | Gives a list of annotations of the form: ``(begin, end, value)``
When the tier contains reference annotations this will be returned,
check :func:`get_ref_annotation_data_for_tier` for the format.
:param str id_tier: Name of the tier.
:raises KeyError: If the tier is non existent. | pympi/Elan.py | def get_annotation_data_for_tier(self, id_tier):
"""Gives a list of annotations of the form: ``(begin, end, value)``
When the tier contains reference annotations this will be returned,
check :func:`get_ref_annotation_data_for_tier` for the format.
:param str id_tier: Name of the tier.
... | def get_annotation_data_for_tier(self, id_tier):
"""Gives a list of annotations of the form: ``(begin, end, value)``
When the tier contains reference annotations this will be returned,
check :func:`get_ref_annotation_data_for_tier` for the format.
:param str id_tier: Name of the tier.
... | [
"Gives",
"a",
"list",
"of",
"annotations",
"of",
"the",
"form",
":",
"(",
"begin",
"end",
"value",
")",
"When",
"the",
"tier",
"contains",
"reference",
"annotations",
"this",
"will",
"be",
"returned",
"check",
":",
"func",
":",
"get_ref_annotation_data_for_tie... | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L618-L630 | [
"def",
"get_annotation_data_for_tier",
"(",
"self",
",",
"id_tier",
")",
":",
"if",
"self",
".",
"tiers",
"[",
"id_tier",
"]",
"[",
"1",
"]",
":",
"return",
"self",
".",
"get_ref_annotation_data_for_tier",
"(",
"id_tier",
")",
"a",
"=",
"self",
".",
"tiers... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_child_tiers_for | Give all child tiers for a tier.
:param str id_tier: Name of the tier.
:returns: List of all children
:raises KeyError: If the tier is non existent. | pympi/Elan.py | def get_child_tiers_for(self, id_tier):
"""Give all child tiers for a tier.
:param str id_tier: Name of the tier.
:returns: List of all children
:raises KeyError: If the tier is non existent.
"""
self.tiers[id_tier]
return [m for m in self.tiers if 'PARENT_REF' i... | def get_child_tiers_for(self, id_tier):
"""Give all child tiers for a tier.
:param str id_tier: Name of the tier.
:returns: List of all children
:raises KeyError: If the tier is non existent.
"""
self.tiers[id_tier]
return [m for m in self.tiers if 'PARENT_REF' i... | [
"Give",
"all",
"child",
"tiers",
"for",
"a",
"tier",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L632-L641 | [
"def",
"get_child_tiers_for",
"(",
"self",
",",
"id_tier",
")",
":",
"self",
".",
"tiers",
"[",
"id_tier",
"]",
"return",
"[",
"m",
"for",
"m",
"in",
"self",
".",
"tiers",
"if",
"'PARENT_REF'",
"in",
"self",
".",
"tiers",
"[",
"m",
"]",
"[",
"2",
"... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_full_time_interval | Give the full time interval of the file. Note that the real interval
can be longer because the sound file attached can be longer.
:returns: Tuple of the form: ``(min_time, max_time)``. | pympi/Elan.py | def get_full_time_interval(self):
"""Give the full time interval of the file. Note that the real interval
can be longer because the sound file attached can be longer.
:returns: Tuple of the form: ``(min_time, max_time)``.
"""
return (0, 0) if not self.timeslots else\
... | def get_full_time_interval(self):
"""Give the full time interval of the file. Note that the real interval
can be longer because the sound file attached can be longer.
:returns: Tuple of the form: ``(min_time, max_time)``.
"""
return (0, 0) if not self.timeslots else\
... | [
"Give",
"the",
"full",
"time",
"interval",
"of",
"the",
"file",
".",
"Note",
"that",
"the",
"real",
"interval",
"can",
"be",
"longer",
"because",
"the",
"sound",
"file",
"attached",
"can",
"be",
"longer",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L643-L650 | [
"def",
"get_full_time_interval",
"(",
"self",
")",
":",
"return",
"(",
"0",
",",
"0",
")",
"if",
"not",
"self",
".",
"timeslots",
"else",
"(",
"min",
"(",
"self",
".",
"timeslots",
".",
"values",
"(",
")",
")",
",",
"max",
"(",
"self",
".",
"timesl... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_gaps_and_overlaps | Give gaps and overlaps. The return types are shown in the table
below. The string will be of the format: ``id_tiername_tiername``.
.. note:: There is also a faster method: :func:`get_gaps_and_overlaps2`
For example when a gap occurs between tier1 and tier2 and they are
called ``speaker... | pympi/Elan.py | def get_gaps_and_overlaps(self, tier1, tier2, maxlen=-1):
"""Give gaps and overlaps. The return types are shown in the table
below. The string will be of the format: ``id_tiername_tiername``.
.. note:: There is also a faster method: :func:`get_gaps_and_overlaps2`
For example when a gap... | def get_gaps_and_overlaps(self, tier1, tier2, maxlen=-1):
"""Give gaps and overlaps. The return types are shown in the table
below. The string will be of the format: ``id_tiername_tiername``.
.. note:: There is also a faster method: :func:`get_gaps_and_overlaps2`
For example when a gap... | [
"Give",
"gaps",
"and",
"overlaps",
".",
"The",
"return",
"types",
"are",
"shown",
"in",
"the",
"table",
"below",
".",
"The",
"string",
"will",
"be",
"of",
"the",
"format",
":",
"id_tiername_tiername",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L652-L751 | [
"def",
"get_gaps_and_overlaps",
"(",
"self",
",",
"tier1",
",",
"tier2",
",",
"maxlen",
"=",
"-",
"1",
")",
":",
"spkr1anns",
"=",
"sorted",
"(",
"(",
"self",
".",
"timeslots",
"[",
"a",
"[",
"0",
"]",
"]",
",",
"self",
".",
"timeslots",
"[",
"a",
... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_gaps_and_overlaps2 | Faster variant of :func:`get_gaps_and_overlaps`. Faster in this case
means almost 100 times faster...
:param str tier1: Name of the first tier.
:param str tier2: Name of the second tier.
:param int maxlen: Maximum length of gaps (skip longer ones), if ``-1``
n... | pympi/Elan.py | def get_gaps_and_overlaps2(self, tier1, tier2, maxlen=-1):
"""Faster variant of :func:`get_gaps_and_overlaps`. Faster in this case
means almost 100 times faster...
:param str tier1: Name of the first tier.
:param str tier2: Name of the second tier.
:param int maxlen: Maximum len... | def get_gaps_and_overlaps2(self, tier1, tier2, maxlen=-1):
"""Faster variant of :func:`get_gaps_and_overlaps`. Faster in this case
means almost 100 times faster...
:param str tier1: Name of the first tier.
:param str tier2: Name of the second tier.
:param int maxlen: Maximum len... | [
"Faster",
"variant",
"of",
":",
"func",
":",
"get_gaps_and_overlaps",
".",
"Faster",
"in",
"this",
"case",
"means",
"almost",
"100",
"times",
"faster",
"..."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L753-L782 | [
"def",
"get_gaps_and_overlaps2",
"(",
"self",
",",
"tier1",
",",
"tier2",
",",
"maxlen",
"=",
"-",
"1",
")",
":",
"ad",
"=",
"sorted",
"(",
"(",
"(",
"a",
",",
"i",
"+",
"1",
")",
"for",
"i",
",",
"t",
"in",
"enumerate",
"(",
"[",
"tier1",
",",... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_ref_annotation_at_time | Give the ref annotations at the given time of the form
``[(start, end, value, refvalue)]``
:param str tier: Name of the tier.
:param int time: Time of the annotation of the parent.
:returns: List of annotations at that time.
:raises KeyError: If the tier is non existent. | pympi/Elan.py | def get_ref_annotation_at_time(self, tier, time):
"""Give the ref annotations at the given time of the form
``[(start, end, value, refvalue)]``
:param str tier: Name of the tier.
:param int time: Time of the annotation of the parent.
:returns: List of annotations at that time.
... | def get_ref_annotation_at_time(self, tier, time):
"""Give the ref annotations at the given time of the form
``[(start, end, value, refvalue)]``
:param str tier: Name of the tier.
:param int time: Time of the annotation of the parent.
:returns: List of annotations at that time.
... | [
"Give",
"the",
"ref",
"annotations",
"at",
"the",
"given",
"time",
"of",
"the",
"form",
"[",
"(",
"start",
"end",
"value",
"refvalue",
")",
"]"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L877-L893 | [
"def",
"get_ref_annotation_at_time",
"(",
"self",
",",
"tier",
",",
"time",
")",
":",
"bucket",
"=",
"[",
"]",
"for",
"aid",
",",
"(",
"ref",
",",
"value",
",",
"_",
",",
"_",
")",
"in",
"self",
".",
"tiers",
"[",
"tier",
"]",
"[",
"1",
"]",
".... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_ref_annotation_data_after_time | Give the ref annotation after a time. If an annotation overlaps
with `ktime`` that annotation will be returned.
:param str id_tier: Name of the tier.
:param int time: Time to get the annotation after.
:returns: Annotation after that time in a list
:raises KeyError: If the tier i... | pympi/Elan.py | def get_ref_annotation_data_after_time(self, id_tier, time):
"""Give the ref annotation after a time. If an annotation overlaps
with `ktime`` that annotation will be returned.
:param str id_tier: Name of the tier.
:param int time: Time to get the annotation after.
:returns: Anno... | def get_ref_annotation_data_after_time(self, id_tier, time):
"""Give the ref annotation after a time. If an annotation overlaps
with `ktime`` that annotation will be returned.
:param str id_tier: Name of the tier.
:param int time: Time to get the annotation after.
:returns: Anno... | [
"Give",
"the",
"ref",
"annotation",
"after",
"a",
"time",
".",
"If",
"an",
"annotation",
"overlaps",
"with",
"ktime",
"that",
"annotation",
"will",
"be",
"returned",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L895-L909 | [
"def",
"get_ref_annotation_data_after_time",
"(",
"self",
",",
"id_tier",
",",
"time",
")",
":",
"befores",
"=",
"self",
".",
"get_ref_annotation_data_between_times",
"(",
"id_tier",
",",
"time",
",",
"self",
".",
"get_full_time_interval",
"(",
")",
")",
"if",
"... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_ref_annotation_data_before_time | Give the ref annotation before a time. If an annotation overlaps
with ``time`` that annotation will be returned.
:param str id_tier: Name of the tier.
:param int time: Time to get the annotation before.
:returns: Annotation before that time in a list
:raises KeyError: If the tie... | pympi/Elan.py | def get_ref_annotation_data_before_time(self, id_tier, time):
"""Give the ref annotation before a time. If an annotation overlaps
with ``time`` that annotation will be returned.
:param str id_tier: Name of the tier.
:param int time: Time to get the annotation before.
:returns: A... | def get_ref_annotation_data_before_time(self, id_tier, time):
"""Give the ref annotation before a time. If an annotation overlaps
with ``time`` that annotation will be returned.
:param str id_tier: Name of the tier.
:param int time: Time to get the annotation before.
:returns: A... | [
"Give",
"the",
"ref",
"annotation",
"before",
"a",
"time",
".",
"If",
"an",
"annotation",
"overlaps",
"with",
"time",
"that",
"annotation",
"will",
"be",
"returned",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L911-L924 | [
"def",
"get_ref_annotation_data_before_time",
"(",
"self",
",",
"id_tier",
",",
"time",
")",
":",
"befores",
"=",
"self",
".",
"get_ref_annotation_data_between_times",
"(",
"id_tier",
",",
"0",
",",
"time",
")",
"if",
"befores",
":",
"return",
"[",
"max",
"(",... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_ref_annotation_data_between_times | Give the ref annotations between times of the form
``[(start, end, value, refvalue)]``
:param str tier: Name of the tier.
:param int start: End time of the annotation of the parent.
:param int end: Start time of the annotation of the parent.
:returns: List of annotations at that... | pympi/Elan.py | def get_ref_annotation_data_between_times(self, id_tier, start, end):
"""Give the ref annotations between times of the form
``[(start, end, value, refvalue)]``
:param str tier: Name of the tier.
:param int start: End time of the annotation of the parent.
:param int end: Start ti... | def get_ref_annotation_data_between_times(self, id_tier, start, end):
"""Give the ref annotations between times of the form
``[(start, end, value, refvalue)]``
:param str tier: Name of the tier.
:param int start: End time of the annotation of the parent.
:param int end: Start ti... | [
"Give",
"the",
"ref",
"annotations",
"between",
"times",
"of",
"the",
"form",
"[",
"(",
"start",
"end",
"value",
"refvalue",
")",
"]"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L926-L943 | [
"def",
"get_ref_annotation_data_between_times",
"(",
"self",
",",
"id_tier",
",",
"start",
",",
"end",
")",
":",
"bucket",
"=",
"[",
"]",
"for",
"aid",
",",
"(",
"ref",
",",
"value",
",",
"_",
",",
"_",
")",
"in",
"self",
".",
"tiers",
"[",
"id_tier"... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_ref_annotation_data_for_tier | Give a list of all reference annotations of the form:
``[(start, end, value, refvalue)]``
:param str id_tier: Name of the tier.
:raises KeyError: If the tier is non existent.
:returns: Reference annotations within that tier. | pympi/Elan.py | def get_ref_annotation_data_for_tier(self, id_tier):
""""Give a list of all reference annotations of the form:
``[(start, end, value, refvalue)]``
:param str id_tier: Name of the tier.
:raises KeyError: If the tier is non existent.
:returns: Reference annotations within that tie... | def get_ref_annotation_data_for_tier(self, id_tier):
""""Give a list of all reference annotations of the form:
``[(start, end, value, refvalue)]``
:param str id_tier: Name of the tier.
:raises KeyError: If the tier is non existent.
:returns: Reference annotations within that tie... | [
"Give",
"a",
"list",
"of",
"all",
"reference",
"annotations",
"of",
"the",
"form",
":",
"[",
"(",
"start",
"end",
"value",
"refvalue",
")",
"]"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L945-L958 | [
"def",
"get_ref_annotation_data_for_tier",
"(",
"self",
",",
"id_tier",
")",
":",
"bucket",
"=",
"[",
"]",
"for",
"aid",
",",
"(",
"ref",
",",
"value",
",",
"prev",
",",
"_",
")",
"in",
"self",
".",
"tiers",
"[",
"id_tier",
"]",
"[",
"1",
"]",
".",... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_parent_aligned_annotation | Give the aligment annotation that a reference annotation belongs to directly, or indirectly through other
reference annotations.
:param str ref_id: Id of a reference annotation.
:raises KeyError: If no annotation exists with the id or if it belongs to an alignment annotation.
:returns: T... | pympi/Elan.py | def get_parent_aligned_annotation(self, ref_id):
"""" Give the aligment annotation that a reference annotation belongs to directly, or indirectly through other
reference annotations.
:param str ref_id: Id of a reference annotation.
:raises KeyError: If no annotation exists with the id or... | def get_parent_aligned_annotation(self, ref_id):
"""" Give the aligment annotation that a reference annotation belongs to directly, or indirectly through other
reference annotations.
:param str ref_id: Id of a reference annotation.
:raises KeyError: If no annotation exists with the id or... | [
"Give",
"the",
"aligment",
"annotation",
"that",
"a",
"reference",
"annotation",
"belongs",
"to",
"directly",
"or",
"indirectly",
"through",
"other",
"reference",
"annotations",
".",
":",
"param",
"str",
"ref_id",
":",
"Id",
"of",
"a",
"reference",
"annotation",... | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L960-L972 | [
"def",
"get_parent_aligned_annotation",
"(",
"self",
",",
"ref_id",
")",
":",
"parentTier",
"=",
"self",
".",
"tiers",
"[",
"self",
".",
"annotations",
"[",
"ref_id",
"]",
"]",
"while",
"\"PARENT_REF\"",
"in",
"parentTier",
"[",
"2",
"]",
"and",
"len",
"("... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.get_tier_ids_for_linguistic_type | Give a list of all tiers matching a linguistic type.
:param str ling_type: Name of the linguistic type.
:param str parent: Only match tiers from this parent, when ``None``
this option will be ignored.
:returns: List of tiernames.
:raises KeyError: If a tier or... | pympi/Elan.py | def get_tier_ids_for_linguistic_type(self, ling_type, parent=None):
"""Give a list of all tiers matching a linguistic type.
:param str ling_type: Name of the linguistic type.
:param str parent: Only match tiers from this parent, when ``None``
this option will be ignor... | def get_tier_ids_for_linguistic_type(self, ling_type, parent=None):
"""Give a list of all tiers matching a linguistic type.
:param str ling_type: Name of the linguistic type.
:param str parent: Only match tiers from this parent, when ``None``
this option will be ignor... | [
"Give",
"a",
"list",
"of",
"all",
"tiers",
"matching",
"a",
"linguistic",
"type",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L978-L989 | [
"def",
"get_tier_ids_for_linguistic_type",
"(",
"self",
",",
"ling_type",
",",
"parent",
"=",
"None",
")",
":",
"return",
"[",
"t",
"for",
"t",
"in",
"self",
".",
"tiers",
"if",
"self",
".",
"tiers",
"[",
"t",
"]",
"[",
"2",
"]",
"[",
"'LINGUISTIC_TYPE... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.insert_annotation | .. deprecated:: 1.2
Use :func:`add_annotation` instead. | pympi/Elan.py | def insert_annotation(self, id_tier, start, end, value='', svg_ref=None):
""".. deprecated:: 1.2
Use :func:`add_annotation` instead.
"""
return self.add_annotation(id_tier, start, end, value, svg_ref) | def insert_annotation(self, id_tier, start, end, value='', svg_ref=None):
""".. deprecated:: 1.2
Use :func:`add_annotation` instead.
"""
return self.add_annotation(id_tier, start, end, value, svg_ref) | [
"..",
"deprecated",
"::",
"1",
".",
"2"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L998-L1003 | [
"def",
"insert_annotation",
"(",
"self",
",",
"id_tier",
",",
"start",
",",
"end",
",",
"value",
"=",
"''",
",",
"svg_ref",
"=",
"None",
")",
":",
"return",
"self",
".",
"add_annotation",
"(",
"id_tier",
",",
"start",
",",
"end",
",",
"value",
",",
"... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.insert_ref_annotation | .. deprecated:: 1.2
Use :func:`add_ref_annotation` instead. | pympi/Elan.py | def insert_ref_annotation(self, id_tier, tier2, time, value='',
prev=None, svg=None):
""".. deprecated:: 1.2
Use :func:`add_ref_annotation` instead.
"""
return self.add_ref_annotation(id_tier, tier2, time, value, prev, svg) | def insert_ref_annotation(self, id_tier, tier2, time, value='',
prev=None, svg=None):
""".. deprecated:: 1.2
Use :func:`add_ref_annotation` instead.
"""
return self.add_ref_annotation(id_tier, tier2, time, value, prev, svg) | [
"..",
"deprecated",
"::",
"1",
".",
"2"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L1005-L1011 | [
"def",
"insert_ref_annotation",
"(",
"self",
",",
"id_tier",
",",
"tier2",
",",
"time",
",",
"value",
"=",
"''",
",",
"prev",
"=",
"None",
",",
"svg",
"=",
"None",
")",
":",
"return",
"self",
".",
"add_ref_annotation",
"(",
"id_tier",
",",
"tier2",
","... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.merge_tiers | Merge tiers into a new tier and when the gap is lower then the
threshhold glue the annotations together.
:param list tiers: List of tier names.
:param str tiernew: Name for the new tier, if ``None`` the name will be
generated.
:param int gapt: Threshhold for ... | pympi/Elan.py | def merge_tiers(self, tiers, tiernew=None, gapt=0, sep='_', safe=False):
"""Merge tiers into a new tier and when the gap is lower then the
threshhold glue the annotations together.
:param list tiers: List of tier names.
:param str tiernew: Name for the new tier, if ``None`` the name wil... | def merge_tiers(self, tiers, tiernew=None, gapt=0, sep='_', safe=False):
"""Merge tiers into a new tier and when the gap is lower then the
threshhold glue the annotations together.
:param list tiers: List of tier names.
:param str tiernew: Name for the new tier, if ``None`` the name wil... | [
"Merge",
"tiers",
"into",
"a",
"new",
"tier",
"and",
"when",
"the",
"gap",
"is",
"lower",
"then",
"the",
"threshhold",
"glue",
"the",
"annotations",
"together",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L1013-L1047 | [
"def",
"merge_tiers",
"(",
"self",
",",
"tiers",
",",
"tiernew",
"=",
"None",
",",
"gapt",
"=",
"0",
",",
"sep",
"=",
"'_'",
",",
"safe",
"=",
"False",
")",
":",
"if",
"tiernew",
"is",
"None",
":",
"tiernew",
"=",
"u'{}_merged'",
".",
"format",
"("... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.remove_all_annotations_from_tier | remove all annotations from a tier
:param str id_tier: Name of the tier.
:raises KeyError: If the tier is non existent. | pympi/Elan.py | def remove_all_annotations_from_tier(self, id_tier, clean=True):
"""remove all annotations from a tier
:param str id_tier: Name of the tier.
:raises KeyError: If the tier is non existent.
"""
for aid in self.tiers[id_tier][0]:
del(self.annotations[aid])
for a... | def remove_all_annotations_from_tier(self, id_tier, clean=True):
"""remove all annotations from a tier
:param str id_tier: Name of the tier.
:raises KeyError: If the tier is non existent.
"""
for aid in self.tiers[id_tier][0]:
del(self.annotations[aid])
for a... | [
"remove",
"all",
"annotations",
"from",
"a",
"tier"
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L1049-L1063 | [
"def",
"remove_all_annotations_from_tier",
"(",
"self",
",",
"id_tier",
",",
"clean",
"=",
"True",
")",
":",
"for",
"aid",
"in",
"self",
".",
"tiers",
"[",
"id_tier",
"]",
"[",
"0",
"]",
":",
"del",
"(",
"self",
".",
"annotations",
"[",
"aid",
"]",
"... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.remove_annotation | Remove an annotation in a tier, if you need speed the best thing is
to clean the timeslots after the last removal. When the tier contains
reference annotations :func:`remove_ref_annotation` will be executed
instead.
:param str id_tier: Name of the tier.
:param int time: Timepoin... | pympi/Elan.py | def remove_annotation(self, id_tier, time, clean=True):
"""Remove an annotation in a tier, if you need speed the best thing is
to clean the timeslots after the last removal. When the tier contains
reference annotations :func:`remove_ref_annotation` will be executed
instead.
:par... | def remove_annotation(self, id_tier, time, clean=True):
"""Remove an annotation in a tier, if you need speed the best thing is
to clean the timeslots after the last removal. When the tier contains
reference annotations :func:`remove_ref_annotation` will be executed
instead.
:par... | [
"Remove",
"an",
"annotation",
"in",
"a",
"tier",
"if",
"you",
"need",
"speed",
"the",
"best",
"thing",
"is",
"to",
"clean",
"the",
"timeslots",
"after",
"the",
"last",
"removal",
".",
"When",
"the",
"tier",
"contains",
"reference",
"annotations",
":",
"fun... | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L1065-L1088 | [
"def",
"remove_annotation",
"(",
"self",
",",
"id_tier",
",",
"time",
",",
"clean",
"=",
"True",
")",
":",
"if",
"self",
".",
"tiers",
"[",
"id_tier",
"]",
"[",
"1",
"]",
":",
"return",
"self",
".",
"remove_ref_annotation",
"(",
"id_tier",
",",
"time",... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
test | Eaf.remove_cv_description | Remove a controlled vocabulary description.
:param str cv_id: Name of the controlled vocabulary.
:paarm str cve_id: Name of the entry.
:throws KeyError: If there is no controlled vocabulary with that name. | pympi/Elan.py | def remove_cv_description(self, cv_id, lang_ref):
"""Remove a controlled vocabulary description.
:param str cv_id: Name of the controlled vocabulary.
:paarm str cve_id: Name of the entry.
:throws KeyError: If there is no controlled vocabulary with that name.
"""
for i, (... | def remove_cv_description(self, cv_id, lang_ref):
"""Remove a controlled vocabulary description.
:param str cv_id: Name of the controlled vocabulary.
:paarm str cve_id: Name of the entry.
:throws KeyError: If there is no controlled vocabulary with that name.
"""
for i, (... | [
"Remove",
"a",
"controlled",
"vocabulary",
"description",
"."
] | dopefishh/pympi | python | https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Elan.py#L1108-L1118 | [
"def",
"remove_cv_description",
"(",
"self",
",",
"cv_id",
",",
"lang_ref",
")",
":",
"for",
"i",
",",
"(",
"l",
",",
"d",
")",
"in",
"reversed",
"(",
"enumerate",
"(",
"self",
".",
"controlled_vocabularies",
"[",
"cv_id",
"]",
"[",
"1",
"]",
")",
")... | 79c747cde45b5ba203ed93154d8c123ac9c3ef56 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.