Powered by OPF
OPF WIKI STATIC ARCHIVE
2,681 pages · 153 spaces · 776 tags · 4,025 history records · 96.2% of the original wiki recovered
Archived copy. This page was recovered from the Internet Archive snapshot of /pages/viewpage.action?pageId=36012109 taken on 2022-07-07. The original wiki at wiki.opf-labs.org is being decommissioned.

PIG User Defined Functions to operate on extracted web content

Created by Sven Schlarb on Dec 03, 2013 · last edited by Per Møldrup-Dalum · on Dec 03, 2013 (view history) · 13 versions

Working plan

Pig examples

-- Simple language detection example
--register 'target/warcbase-0.1.0-SNAPSHOT-fatjar.jar';
DEFINE ArcLoader org.warcbase.pig.ArcLoader();
DEFINE ExtractRawText org.warcbase.pig.piggybank.ExtractRawText();
DEFINE DetectLanguage org.warcbase.pig.piggybank.DetectLanguage();
raw = load '$testArcFolder'
    using ArcLoader() as (url: chararray, date:chararray, mime:chararray, content:chararray);
b = foreach raw generate url, mime, ExtractRawText(content) as content;
-- c = foreach b generate url,mime,DetectLanguage(content) as lang;
c1 = foreach b generate DetectLanguage(content) as lang;
d = group c1 by lang;
g = foreach d generate group, COUNT(c1);
store e into '$experimentfolder/e';

For now clone https://github.com/perdalum/warcbase and checkout the pig-integration branch. Running the unit tests will run the above Pig Latin script on the provided test gzip'ed ARC file. The language distribution reported by Tika is:

Goals

Create UDFs for