-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
301 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pimarc | ||
====== | ||
|
||
.. automodule:: pimlico.cli.pimarc | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
index | ||
===== | ||
|
||
.. automodule:: pimlico.utils.pimarc.index | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
reader | ||
====== | ||
|
||
.. automodule:: pimlico.utils.pimarc.reader | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
pimarc | ||
====== | ||
|
||
Submodules | ||
---------- | ||
|
||
.. toctree:: | ||
|
||
pimlico.utils.pimarc.index | ||
pimlico.utils.pimarc.reader | ||
pimlico.utils.pimarc.tar | ||
pimlico.utils.pimarc.tools | ||
pimlico.utils.pimarc.utils | ||
pimlico.utils.pimarc.writer | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: pimlico.utils.pimarc | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tar | ||
=== | ||
|
||
.. automodule:: pimlico.utils.pimarc.tar | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tools | ||
===== | ||
|
||
.. automodule:: pimlico.utils.pimarc.tools | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
utils | ||
===== | ||
|
||
.. automodule:: pimlico.utils.pimarc.utils | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
writer | ||
====== | ||
|
||
.. automodule:: pimlico.utils.pimarc.writer | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
varint | ||
====== | ||
|
||
.. automodule:: pimlico.utils.varint | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.. _command_tar2pimarc: | ||
|
||
tar2pimarc | ||
~~~~~~~~~~ | ||
|
||
|
||
*Command-line tool subcommand* | ||
|
||
|
||
Convert grouped corpora from the old tar-based storage format to Pimarc | ||
archives. | ||
|
||
|
||
Usage: | ||
|
||
:: | ||
|
||
pimlico.sh [...] tar2pimarc [outputs [outputs ...]] [-h] [--run] | ||
|
||
|
||
Positional arguments | ||
==================== | ||
|
||
+-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| Arg | Description | | ||
+=============================+=================================================================================================================================================================================================================================================================+ | ||
| ``[outputs [outputs ...]]`` | Specification of module outputs to convert. Specific datasets can be given as 'module_name.output_name'. All grouped corpus outputs of a module can be converted by just giving 'module_name'. Or, if nothing's given, all outputs of all modules are converted | | ||
+-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
|
||
Options | ||
======= | ||
|
||
+-----------+------------------------------------------------------------------------------+ | ||
| Option | Description | | ||
+===========+==============================================================================+ | ||
| ``--run`` | Run conversion. Without this option, just checks what format the corpora use | | ||
+-----------+------------------------------------------------------------------------------+ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
Random subsample | ||
~~~~~~~~~~~~~~~~ | ||
|
||
.. py:module:: pimlico.modules.corpora.subsample | ||
+------------+-----------------------------------+ | ||
| Path | pimlico.modules.corpora.subsample | | ||
+------------+-----------------------------------+ | ||
| Executable | yes | | ||
+------------+-----------------------------------+ | ||
|
||
Randomly subsample documents of a corpus at a given rate to create a smaller corpus. | ||
|
||
|
||
Inputs | ||
====== | ||
|
||
+--------+---------------------------------------------------------------------------+ | ||
| Name | Type(s) | | ||
+========+===========================================================================+ | ||
| corpus | :class:`grouped_corpus <pimlico.datatypes.corpora.grouped.GroupedCorpus>` | | ||
+--------+---------------------------------------------------------------------------+ | ||
|
||
Outputs | ||
======= | ||
|
||
+--------+--------------------------------------------------------------------------------------------------------+ | ||
| Name | Type(s) | | ||
+========+========================================================================================================+ | ||
| corpus | :class:`corpus with data-point from input <pimlico.datatypes.corpora.grouped.CorpusWithTypeFromInput>` | | ||
+--------+--------------------------------------------------------------------------------------------------------+ | ||
|
||
|
||
Options | ||
======= | ||
|
||
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+ | ||
| Name | Description | Type | | ||
+==============+==============================================================================================================================================================+=======+ | ||
| p | (required) Probability of including any given document. The resulting corpus will be roughly this proportion of the size of the input | float | | ||
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+ | ||
| seed | Random seed. We always set a random seed before starting to ensure some level of reproducability | int | | ||
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+ | ||
| skip_invalid | Skip over any invalid documents so that the output subset contains just valid document and no invalid ones. By default, invalid documents are passed through | bool | | ||
+--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+ | ||
|
||
Example config | ||
============== | ||
|
||
This is an example of how this module can be used in a pipeline config file. | ||
|
||
.. code-block:: ini | ||
[my_subsample_module] | ||
type=pimlico.modules.corpora.subsample | ||
input_corpus=module_a.some_output | ||
p=0.1 | ||
This example usage includes more options. | ||
|
||
.. code-block:: ini | ||
[my_subsample_module] | ||
type=pimlico.modules.corpora.subsample | ||
input_corpus=module_a.some_output | ||
p=0.1 | ||
seed=1234 | ||
skip_invalid=T | ||
Test pipelines | ||
============== | ||
|
||
This module is used by the following :ref:`test pipelines <test-pipelines>`. They are a further source of examples of the module's usage. | ||
|
||
* :ref:`test-config-subsample.conf` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.. _test-config-subsample.conf: | ||
|
||
subsample | ||
~~~~~~~~~ | ||
|
||
|
||
|
||
This is one of the test pipelines included in Pimlico's repository. | ||
See :ref:`test-pipelines` for more details. | ||
|
||
Config file | ||
=========== | ||
|
||
The complete config file for this test pipeline: | ||
|
||
|
||
.. code-block:: ini | ||
[pipeline] | ||
name=subsample | ||
release=latest | ||
# Take input from a prepared Pimlico dataset | ||
[europarl] | ||
type=pimlico.datatypes.corpora.GroupedCorpus | ||
data_point_type=RawTextDocumentType | ||
dir=%(test_data_dir)s/datasets/text_corpora/europarl | ||
[subsample] | ||
type=pimlico.modules.corpora.subsample | ||
p=0.8 | ||
seed=1 | ||
Modules | ||
======= | ||
|
||
|
||
The following Pimlico module types are used in this pipeline: | ||
|
||
* :mod:`~pimlico.modules.corpora.subsample` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
.. _test-config-vocab_mapper_longer.conf: | ||
|
||
vocab\_mapper | ||
~~~~~~~~~~~~~ | ||
|
||
|
||
|
||
This is one of the test pipelines included in Pimlico's repository. | ||
See :ref:`test-pipelines` for more details. | ||
|
||
Config file | ||
=========== | ||
|
||
The complete config file for this test pipeline: | ||
|
||
|
||
.. code-block:: ini | ||
[pipeline] | ||
name=vocab_mapper | ||
release=latest | ||
# Take input from a prepared Pimlico dataset | ||
[europarl] | ||
type=pimlico.datatypes.corpora.GroupedCorpus | ||
data_point_type=TokenizedDocumentType | ||
dir=%(test_data_dir)s/datasets/corpora/tokenized_longer | ||
# Load the prepared vocabulary | ||
# (created by the vocab_builder test pipeline) | ||
[vocab] | ||
type=pimlico.datatypes.dictionary.Dictionary | ||
dir=%(test_data_dir)s/datasets/vocab | ||
# Perform the mapping from words to IDs | ||
[ids] | ||
type=pimlico.modules.corpora.vocab_mapper | ||
input_vocab=vocab | ||
input_text=europarl | ||
Modules | ||
======= | ||
|
||
|
||
The following Pimlico module types are used in this pipeline: | ||
|
||
* :mod:`~pimlico.modules.corpora.vocab_mapper` | ||
|
||
|
Oops, something went wrong.