@@ -16,8 +16,8 @@ In this library we have sequences and analyzers.
...
@@ -16,8 +16,8 @@ In this library we have sequences and analyzers.
+ The level in a sequence is used like a path in a directory, to access the different subsequences in analyzers or filter funtions. In our example we have:
+ The level in a sequence is used like a path in a directory, to access the different subsequences in analyzers or filter funtions. In our example we have:
- Text
- Text
-Phrases
-Phrases
-Words
-Words
So, to access children of level Words we can use "Phrases/Words" in filter or analyze. As the same mode, we can use "Phrases/Words/text" to access a text(value of metadata dictionary) at the Words level in functions like filterMetadata or analyze.
So, to access children of level Words we can use "Phrases/Words" in filter or analyze. As the same mode, we can use "Phrases/Words/text" to access a text(value of metadata dictionary) at the Words level in functions like filterMetadata or analyze.
...
@@ -297,90 +297,90 @@ If you want to create a class to initialize a sequence and there is no class for
...
@@ -297,90 +297,90 @@ If you want to create a class to initialize a sequence and there is no class for
-**Now, we have to create the __init__ function in the class:**
-**Now, we have to create the __init__ function in the class:**
def __init__(self):
def __init__(self):
pass
pass
- **First of all, we have to call self.initializeSequence("format"), this function initialize the metadata, and children dictionary of a Sequence and put the format of a sequence.**
- **First of all, we have to call self.initializeSequence("format"), this function initialize the metadata, and children dictionary of a Sequence and put the format of a sequence.**
We are going to see, how to initialize a sequence from a directory.
We are going to see, how to initialize a sequence from a directory.
def __init__(self):
def __init__(self):
# Initializes the attributes of a sequence.
# Initializes the attributes of a sequence.
self.initializeSequence("directory")
self.initializeSequence("directory")
- **Then, we have to think about the metadata that we will have and how the children sequences are going to be built in that initializer.**
- **Then, we have to think about the metadata that we will have and how the children sequences are going to be built in that initializer.**
In the example we have like metadata the name of the files of the directory and the path of the diferent subdirectories.
In the example we have like metadata the name of the files of the directory and the path of the diferent subdirectories.
def __init__(self,src):
def __init__(self,src):
'''
'''
Initialize a Sequence from a directory path
Initialize a Sequence from a directory path
By default, create subsequences for any directories and files in the source directory
By default, create subsequences for any directories and files in the source directory
and for each file, create subsequence, splitting the text of the file into words.
and for each file, create subsequence, splitting the text of the file into words.
- **Finally,we can create the sequences down to the lowest level by calling other sequence initializers and what labels they will have in the children dictionary.**
- **Finally,we can create the sequences down to the lowest level by calling other sequence initializers and what labels they will have in the children dictionary.**
Here, we can see how we add new parameters to create more sublevels in the original sequence.
Here, we can see how we add new parameters to create more sublevels in the original sequence.
-**The result of the new Initializer of a Sequence from directory is look like:**
-**The result of the new Initializer of a Sequence from directory is look like:**
...
@@ -553,28 +553,31 @@ The steps to create an analyzer are:
...
@@ -553,28 +553,31 @@ The steps to create an analyzer are:
+ For example, if we want to do a ironity analyzer, we use a pipeline that need a task, a model, a maximum of Embedding and if return all the scores of only the label with the maximum score of the text. The analyzer must be as flexible as possible, so all of the parameters that need the pipeline are passed like params at the init function.
+ For example, if we want to do a ironity analyzer, we use a pipeline that need a task, a model, a maximum of Embedding and if return all the scores of only the label with the maximum score of the text. The analyzer must be as flexible as possible, so all of the parameters that need the pipeline are passed like params at the init function.
+ Look that inside the __init__ function we modified the labels of the model, this is because the model by defect dont have the labels clearly defined. (NI = Non-Ironic and I = Ironic)
+ Look that inside the init function we modified the labels of the model, this is because the model by defect dont have the labels clearly defined. (NI = Non-Ironic and I = Ironic)