The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Text::Mining::Shell - Command Line Tools for Text Mining

VERSION

This document describes Text::Mining::Shell version 0.0.7

SYNOPSIS

    use Text::Mining;

    my $tm = Text::Mining->new();
    $tm->shell();

  

DESCRIPTION

This module provides the methods for a shell-based system for text mining using Term::Shell.

INTERFACE

Commands generally take the form of noun_verb where nouns are library, corpus, document, language, word, concept, and representation and verbs are list, new, show, update, and delete.

The system is documented online. After starting the shell, type "help" and hit enter for a list of commands.

Term::Shell Extensions

These methods implement new shell features.

  • prompt_str

    Controls the prompt string. May be configurable soon.

  • _load_config

    Loads the YAML config file. The configuration directory is created in $ENV{HOME} by default.

  • _update_config

    Updates a specific key in the config file. Calls _save_config().

  • _save_config

    Saves the passed hashref in the config file .corpus/shellrc.

  • _load_history

    Loads the history from .corpus/shell_history into the term object.

  • _save_history

    Saves the history, one command per line. Implemented using Term::Shell::postcmd().

  • _get_config_filename

    Returns the configuration filename. Based on editable scalar at top of module.

  • _get_history_filename

    Returns the history file filename. Based on editable scalar at top of module.

  • init

    Initializes command history and current corpus.

  • fini

    Saves the command history.

  • postcmd

    Filters actual commands with parameters and updates the history file.

File System Extensions

The following methods enable a WOrking directory. These methods update the configuration, so you return to your last working directory when you restart.

  • smry_cd, help_cd, run_cd

    Change Directory

  • smry_pwd, help_pwd, run_pwd

    Print Working Directory

  • smry_dir, help_dir, run_dir

    List Directory Contents

Text::Mining Features

The following methods implement Term::Shell functions for the specific function in Text::Mining.

  • smry_corpus_list, help_corpus_list, run_corpus_list

    List All Corpuses

  • smry_corpus_show, help_corpus_show, run_corpus_show

    Show a Corpus

  • smry_corpus_set, help_corpus_set, run_corpus_set

    Set Current Corpus

  • smry_corpus_new, help_corpus_new, run_corpus_new

    Create a New Corpus

  • smry_corpus_delete, help_corpus_delete, run_corpus_delete

    Delete a Corpus

  • smry_document_add, help_document_add, run_document_add

    Add a Document to Current Corpus

  • smry_test, help_test, run_test

    Template Subroutines

Internals

The following methods are generally useful by many of the other methods.

  • _cd

    Changes the current directory and updates $ENV{PWD};

  • _relative_path_check

    Inserts $ENV{PWD} into file paths if the do not start with '/'.

  • _print_corpus_head

    Prints corpus list header.

  • _print_corpus

    Prints corpus list row.

  • _get_file_text

    Returns text of file in a scalar.

  • _set_file_text

    Sets text of file.

  • _add_file_text

    Adds to the text of file.

  • _status

    Prints log. Controlled by verbosity setting.

CONFIGURATION AND ENVIRONMENT

Text::Mining::Shell requires a configuration file at ~/.corpus/shellrc.

Text::Mining::Shell also requires Text::Mining to accomplish anything, and it requires a configuration file at ~/.corpus/config.

The default location of these files and their contents may change in future versions.

Future versions will include an install method for initializing the configurations.

DEPENDENCIES

 Term::Shell;
 Text::Mining;
 Text::Mining::Corpus;
 Text::Mining::Corpus::Document;
 File::Spec;
 YAML;
 

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-text-mining-shell@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Roger A Hall <rogerhall@cpan.org>

LICENSE AND COPYRIGHT

Copyright (c) 2009, Roger A Hall <rogerhall@cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.