Help language development. Donate to The Perl Foundation
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.
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.
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. |
$ zef install Tika
$ AUTHOR_TESTING=1 zef test --verbose .
$ zef install Test::META $ AUTHOR_TESTING=1 prove -e "perl6 -Ilib"
Ahmad M. Zawawi, azawawi on #perl6.