Skip to content

Latest commit

 

History

History
80 lines (54 loc) · 2.01 KB

README.md

File metadata and controls

80 lines (54 loc) · 2.01 KB

Tika

Build Status Build status

This is a Perl 6 library for using the Apache Tika Server REST API. Apache Tika server JAR is already included. You just need to install Java runtime or JDK to be able to use it.

Example

use v6;
use Tika;

my $t = TikaWrapper.new;
$t.start;

say "Found {$t.version} server";

say $t.parsers;
say $t.detectors;

my $filename     = 'demo.docx';
my $content-type = $t.mime-type($filename);
say "Detected stream type $content-type";

my $metadata = $t.meta($filename, $content-type);
say "Metadata for $filename:\n{$t._truncate($metadata, 40)}";

my $text = $t.text($filename, $content-type);
say "Found {$text.chars} plain text";

my $language = $t.language($text);
say "Detected language #{$language}";

For more examples, please take a look at examples.

Dependencies

Please follow the instructions for your platform to be able to install Java:

Platform Installation command
Debian apt-get install default-jre
macOS brew tap caskroom/versions
brew cask install java8
Windows Install Oracle 8 Java SE from here.

Installation

  • Install this module using zef:
$ zef install Tika

Testing

  • To run tests:
$ AUTHOR_TESTING=1 zef test --verbose .
  • To run all tests including author tests (Please make sure Test::Meta is installed):
$ zef install Test::META
$ AUTHOR_TESTING=1 prove -e "perl6 -Ilib"

See Also

Author

Ahmad M. Zawawi, azawawi on #perl6.

License

MIT License