web mining uebung 2

This commit is contained in:
Michael Scholz 2013-05-10 08:44:24 +02:00
parent aec4dd0644
commit 2f35427371
41 changed files with 3265 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,5 @@
This is the keaddon add-on. It contains:
* A program (lib/main.js).
* A few tests.
* Some meager documentation.

View File

@ -0,0 +1,26 @@
var text = "";
var cleantext = "";
var paragraphs = document.getElementsByTagName('p');
var open = '<';
var close = '>';
for(var i=0; i<paragraphs.length; i++) {
text += paragraphs[i].innerHTML;
}
var doAppend = true;
var tmp = "";
for(var i=0; i<text.length; i++) {
tmp = text.charAt(i);
if( tmp == open ) {
doAppend = false;
}
if(doAppend) {
cleantext += tmp;
}
if( tmp == close ) {
doAppend = true;
}
}
//cleantext = unescape(cleantext);
postMessage(cleantext);

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="900" height="600"><rect width="900" height="600" fill="#ED2939"/><rect width="600" height="600" fill="#fff"/><rect width="300" height="600" fill="#002395"/></svg>

After

Width:  |  Height:  |  Size: 378 B

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="600" viewBox="0 0 5 3">
<desc>Flag of Germany</desc>
<rect id="black_stripe" width="5" height="3" y="0" x="0" fill="#000"/>
<rect id="red_stripe" width="5" height="2" y="1" x="0" fill="#D00"/>
<rect id="gold_stripe" width="5" height="1" y="2" x="0" fill="#FFCE00"/>
</svg>

After

Width:  |  Height:  |  Size: 491 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 230 KiB

View File

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 30" width="1200" height="600">
<clipPath id="t">
<path d="M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"/>
</clipPath>
<path d="M0,0 v30 h60 v-30 z" fill="#00247d"/>
<path d="M0,0 L60,30 M60,0 L0,30" stroke="#fff" stroke-width="6"/>
<path d="M0,0 L60,30 M60,0 L0,30" clip-path="url(#t)" stroke="#cf142b" stroke-width="4"/>
<path d="M30,0 v30 M0,15 h60" stroke="#fff" stroke-width="10"/>
<path d="M30,0 v30 M0,15 h60" stroke="#cf142b" stroke-width="6"/>
</svg>

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

View File

@ -0,0 +1,2 @@
The main module is a program that creates a widget. When a user clicks on
the widget, the program loads the mozilla.org website in a new tab.

View File

@ -0,0 +1,4 @@
exports.german = 'de';
exports.french = 'fr';
exports.spanish = 'es';
exports.english = 'en';

View File

@ -0,0 +1,65 @@
var widgets = require("widget");
var pageMod = require("page-mod");
var student = require("student");
var data = require("self").data;
var workers = new Array();
var mod = null;
exports.main = function(options, callback) {
mod = pageMod.PageMod(
{
include: "*",
contentScriptWhen:"ready",
contentScriptFile: data.url("./contentScripts/keworker.js"),
onAttach: function onAttach(worker) {
worker.on('message', handleMessage);
workers.push(worker);
}
}
);
var widget = widgets.Widget(
{
id: "ke",
label: "Knowledge Engineering",
contentURL: data.url("keicon.png")
}
);
function handleMessage(message) {
var lang = require("language");
if(message.length > 0) {
//TODO: Iconswitch
var language = student.student(message);
console.log(language);
switch(language) {
case lang.german:
widget.contentURL = data.url("./flag/de.png");
break;
case lang.spanish:
widget.contentURL = data.url("./flag/es.png");
break;
case lang.english:
widget.contentURL = data.url("./flag/en.png");
break;
case lang.french:
widget.contentURL = data.url("./flag/fr.png");
break;
default:
widget.contentURL = data.url("./keicon.png");
}
//TODO: response
}
}
console.log("The add-on is running.");
}
exports.onUnload = function(reason) {
if(mod != null) {mod.destroy();}
for(var i=0; i<workers.length; i++) {
workers[i].destroy();
}
}

View File

@ -0,0 +1,8 @@
var lang = require("language");
var util = require("utility");
function student(text) {
return lang.german;
}
exports.student = student;

View File

@ -0,0 +1,82 @@
/*
Will count all equal array entries and list them in a javascript object such
that there is a object property for each unique array entry. The value of that
property equals the number of occurences. The order of the properties is sorted
according to the number of occurences. With the most occurences first.
You can use this construct
for(var key in obj) {
console.log(obj[key]);
}
to iterate over all items in sorted order.
*/
function countElements(array) {
var tmp = {};
var result = {};
var helpArray = [];
for(var i=0; i<array.length; i++) {
var item = array[i];
if(!tmp.hasOwnProperty( item )) {
tmp[item] = 1;
} else {
tmp[item] += 1;
}
}
for(var key in tmp) {
helpArray.push({key:key, value:tmp[key]});
}
helpArray.sort(comparePairs);
for(var i=0; i<helpArray.length; i++) {
result[helpArray[i].key] = helpArray[i].value;
}
return result;
};
/*Helperfunction for countElements*/
function comparePairs(a,b) {
return b.value - a.value;
}
/*
Tokenize a text at whitespace.
Some punctuations are removed
*/
function tokenize(text) {
var lct = text.toLowerCase();
lct = lct.replace(/(\.|,|!|\?|'|"|\\|\/|\|)/g,"");
var result = lct.split(/\W/g);
return result;
}
/*
Create an array of chars from a given text.
*/
function toCharArray(text) {
var result = [];
for(var i=0; i<text.length; i++) {
result.push(text[i]);
}
return result;
}
/*
Create an array of charpairs from a given text.
*/
function toCharPairs(text) {
var result = [];
if (text.length > 1) {
for(var i=1; i<text.length; i++) {
result.push(text[i-1]+text[i]);
}
}
return result;
}
exports.countElements = countElements;
exports.tokenize = tokenize;
exports.toCharArray = toCharArray;
exports.toCharPairs = toCharPairs;

View File

@ -0,0 +1,10 @@
{
"name": "keaddon",
"license": "MPL 1.1/GPL 2.0/LGPL 2.1",
"author": "Clemens Dörrhöfer",
"version": "0.1",
"fullName": "keaddon",
"id": "jid0-GN3ivO79cgfs9k4P3lxdo7TPFa4",
"description": "a basic add-on",
"icon": "data/keicon.png"
}

View File

@ -0,0 +1,83 @@
const main = require("main");
const lang = require("language");
exports.test_test_run = function(test) {
test.pass("Unit test running!");
};
exports.test_id = function(test) {
test.assert(require("self").id.length > 0);
};
exports.test_url = function(test) {
require("request").Request({
url: "http://www.mozilla.org/",
onComplete: function(response) {
test.assertEqual(response.statusText, "OK");
test.done();
}
}).get();
test.waitUntilDone(20000);
};
exports.test_open_tab = function(test) {
const tabs = require("tabs");
tabs.open({
url: "http://www.mozilla.org/",
onReady: function(tab) {
test.assertEqual(tab.url, "http://www.mozilla.org/");
test.done();
}
});
test.waitUntilDone(20000);
};
var errormessage = "";
exports.test_util_countElements = function(test) {
const util = require("utility");
test.assert(compareObjects(util.countElements(["du", "du", "hallo", "hallo", "du"]),{"hallo":2, "du":3}),errormessage);
};
exports.test_util_toCharArray = function(test) {
const util = require("utility");
test.assert(compareArrays(util.toCharArray("test"), ["t","e","s","t"]), errormessage);
};
exports.test_util_toCharPairs = function(test) {
const util = require("utility");
test.assert(compareArrays(util.toCharPairs("mainz"),["ma", "ai", "in", "nz"]), errormessage);
};
exports.test_util_tokenize = function(test) {
const util = require("utility");
test.assert(compareArrays(util.tokenize("Dem Igel geht's gut."),["dem","igel","gehts","gut"]), errormessage);
};
exports.test_student_student = function(test) {
const student = require("student");
var text = "blubber";
test.assertEqual(student.student(text), lang.german, "Geht nicht weil.");
};
function compareObjects(a,b) {
for(var key in a) {
if( a[key] != b[key] ) {
return false;
}
}
return true;
};
function compareArrays(a,b) {
if (a.length != b.length) {
errormessage = "Arrays of unequal size";
return false
}
for(var i=0; i<a.length; i++) {
if (a[i] != b[i]) {
errormessage = a[i] + " != " + b[i];
return false;
}
}
return true;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,106 @@
\relax
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
\global\let\oldcontentsline\contentsline
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
\global\let\oldnewlabel\newlabel
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
\AtEndDocument{\ifx\hyper@anchor\@undefined
\let\contentsline\oldcontentsline
\let\newlabel\oldnewlabel
\fi}
\fi}
\global\let\hyper@last\relax
\gdef\HyperFirstAtBeginDocument#1{#1}
\providecommand\HyField@AuxAddToFields[1]{}
\catcode`"\active
\@writefile{toc}{\beamer@endinputifotherversion {3.12pt}}
\@writefile{nav}{\beamer@endinputifotherversion {3.12pt}}
\select@language{ngerman}
\@writefile{toc}{\select@language{ngerman}}
\@writefile{lof}{\select@language{ngerman}}
\@writefile{lot}{\select@language{ngerman}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{1}{1/1}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {1}{1}}}
\@writefile{toc}{\beamer@sectionintoc {1}{1. Aufgabe}{2}{0}{1}}
\@writefile{nav}{\headcommand {\sectionentry {1}{1. Aufgabe}{2}{1. Aufgabe}{0}}}
\@writefile{nav}{\headcommand {\beamer@sectionpages {1}{1}}}
\@writefile{nav}{\headcommand {\beamer@subsectionpages {1}{1}}}
\@writefile{nav}{\headcommand {\slideentry {1}{0}{2}{2/2}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {2}{2}}}
\@writefile{nav}{\headcommand {\slideentry {1}{0}{3}{3/3}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {3}{3}}}
\@writefile{nav}{\headcommand {\slideentry {1}{0}{4}{4/4}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {4}{4}}}
\@writefile{nav}{\headcommand {\slideentry {1}{0}{5}{5/5}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {5}{5}}}
\@writefile{nav}{\headcommand {\slideentry {1}{0}{6}{6/6}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {6}{6}}}
\@writefile{toc}{\beamer@sectionintoc {2}{2. Aufgabe}{7}{0}{2}}
\@writefile{nav}{\headcommand {\sectionentry {2}{2. Aufgabe}{7}{2. Aufgabe}{0}}}
\@writefile{nav}{\headcommand {\beamer@sectionpages {2}{6}}}
\@writefile{nav}{\headcommand {\beamer@subsectionpages {2}{6}}}
\@writefile{nav}{\headcommand {\slideentry {2}{0}{7}{7/7}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {7}{7}}}
\@writefile{nav}{\headcommand {\slideentry {2}{0}{8}{8/8}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {8}{8}}}
\@writefile{nav}{\headcommand {\slideentry {2}{0}{9}{9/9}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {9}{9}}}
\@writefile{nav}{\headcommand {\slideentry {2}{0}{10}{10/10}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {10}{10}}}
\@writefile{nav}{\headcommand {\slideentry {2}{0}{11}{11/11}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {11}{11}}}
\@writefile{toc}{\beamer@sectionintoc {3}{3. Aufgabe}{12}{0}{3}}
\@writefile{nav}{\headcommand {\sectionentry {3}{3. Aufgabe}{12}{3. Aufgabe}{0}}}
\@writefile{nav}{\headcommand {\beamer@sectionpages {7}{11}}}
\@writefile{nav}{\headcommand {\beamer@subsectionpages {7}{11}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{12}{12/12}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {12}{12}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{13}{13/13}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {13}{13}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{14}{14/14}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {14}{14}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{15}{15/15}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {15}{15}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{16}{16/16}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {16}{16}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{17}{17/17}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {17}{17}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{18}{18/18}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {18}{18}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{19}{19/19}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {19}{19}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{20}{20/20}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {20}{20}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{21}{21/21}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {21}{21}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{22}{22/22}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {22}{22}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{23}{23/23}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {23}{23}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{24}{24/24}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {24}{24}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{25}{25/25}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {25}{25}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{26}{26/26}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {26}{26}}}
\@writefile{nav}{\headcommand {\slideentry {3}{0}{27}{27/27}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {27}{27}}}
\@writefile{toc}{\beamer@sectionintoc {4}{5. Aufgabe}{28}{0}{4}}
\@writefile{nav}{\headcommand {\sectionentry {4}{5. Aufgabe}{28}{5. Aufgabe}{0}}}
\@writefile{nav}{\headcommand {\beamer@sectionpages {12}{27}}}
\@writefile{nav}{\headcommand {\beamer@subsectionpages {12}{27}}}
\@writefile{nav}{\headcommand {\slideentry {4}{0}{28}{28/28}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {28}{28}}}
\@writefile{nav}{\headcommand {\slideentry {4}{0}{29}{29/29}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {29}{29}}}
\@writefile{nav}{\headcommand {\slideentry {4}{0}{30}{30/30}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {30}{30}}}
\@writefile{nav}{\headcommand {\slideentry {4}{0}{31}{31/31}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {31}{31}}}
\@writefile{nav}{\headcommand {\beamer@partpages {1}{31}}}
\@writefile{nav}{\headcommand {\beamer@subsectionpages {28}{31}}}
\@writefile{nav}{\headcommand {\beamer@sectionpages {28}{31}}}
\@writefile{nav}{\headcommand {\beamer@documentpages {31}}}
\@writefile{nav}{\headcommand {\def \inserttotalframenumber {31}}}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
\beamer@endinputifotherversion {3.12pt}
\headcommand {\slideentry {0}{0}{1}{1/1}{}{0}}
\headcommand {\beamer@framepages {1}{1}}
\headcommand {\sectionentry {1}{1. Aufgabe}{2}{1. Aufgabe}{0}}
\headcommand {\beamer@sectionpages {1}{1}}
\headcommand {\beamer@subsectionpages {1}{1}}
\headcommand {\slideentry {1}{0}{2}{2/2}{}{0}}
\headcommand {\beamer@framepages {2}{2}}
\headcommand {\slideentry {1}{0}{3}{3/3}{}{0}}
\headcommand {\beamer@framepages {3}{3}}
\headcommand {\slideentry {1}{0}{4}{4/4}{}{0}}
\headcommand {\beamer@framepages {4}{4}}
\headcommand {\slideentry {1}{0}{5}{5/5}{}{0}}
\headcommand {\beamer@framepages {5}{5}}
\headcommand {\slideentry {1}{0}{6}{6/6}{}{0}}
\headcommand {\beamer@framepages {6}{6}}
\headcommand {\sectionentry {2}{2. Aufgabe}{7}{2. Aufgabe}{0}}
\headcommand {\beamer@sectionpages {2}{6}}
\headcommand {\beamer@subsectionpages {2}{6}}
\headcommand {\slideentry {2}{0}{7}{7/7}{}{0}}
\headcommand {\beamer@framepages {7}{7}}
\headcommand {\slideentry {2}{0}{8}{8/8}{}{0}}
\headcommand {\beamer@framepages {8}{8}}
\headcommand {\slideentry {2}{0}{9}{9/9}{}{0}}
\headcommand {\beamer@framepages {9}{9}}
\headcommand {\slideentry {2}{0}{10}{10/10}{}{0}}
\headcommand {\beamer@framepages {10}{10}}
\headcommand {\slideentry {2}{0}{11}{11/11}{}{0}}
\headcommand {\beamer@framepages {11}{11}}
\headcommand {\sectionentry {3}{3. Aufgabe}{12}{3. Aufgabe}{0}}
\headcommand {\beamer@sectionpages {7}{11}}
\headcommand {\beamer@subsectionpages {7}{11}}
\headcommand {\slideentry {3}{0}{12}{12/12}{}{0}}
\headcommand {\beamer@framepages {12}{12}}
\headcommand {\slideentry {3}{0}{13}{13/13}{}{0}}
\headcommand {\beamer@framepages {13}{13}}
\headcommand {\slideentry {3}{0}{14}{14/14}{}{0}}
\headcommand {\beamer@framepages {14}{14}}
\headcommand {\slideentry {3}{0}{15}{15/15}{}{0}}
\headcommand {\beamer@framepages {15}{15}}
\headcommand {\slideentry {3}{0}{16}{16/16}{}{0}}
\headcommand {\beamer@framepages {16}{16}}
\headcommand {\slideentry {3}{0}{17}{17/17}{}{0}}
\headcommand {\beamer@framepages {17}{17}}
\headcommand {\slideentry {3}{0}{18}{18/18}{}{0}}
\headcommand {\beamer@framepages {18}{18}}
\headcommand {\slideentry {3}{0}{19}{19/19}{}{0}}
\headcommand {\beamer@framepages {19}{19}}
\headcommand {\slideentry {3}{0}{20}{20/20}{}{0}}
\headcommand {\beamer@framepages {20}{20}}
\headcommand {\slideentry {3}{0}{21}{21/21}{}{0}}
\headcommand {\beamer@framepages {21}{21}}
\headcommand {\slideentry {3}{0}{22}{22/22}{}{0}}
\headcommand {\beamer@framepages {22}{22}}
\headcommand {\slideentry {3}{0}{23}{23/23}{}{0}}
\headcommand {\beamer@framepages {23}{23}}
\headcommand {\slideentry {3}{0}{24}{24/24}{}{0}}
\headcommand {\beamer@framepages {24}{24}}
\headcommand {\slideentry {3}{0}{25}{25/25}{}{0}}
\headcommand {\beamer@framepages {25}{25}}
\headcommand {\slideentry {3}{0}{26}{26/26}{}{0}}
\headcommand {\beamer@framepages {26}{26}}
\headcommand {\slideentry {3}{0}{27}{27/27}{}{0}}
\headcommand {\beamer@framepages {27}{27}}
\headcommand {\sectionentry {4}{5. Aufgabe}{28}{5. Aufgabe}{0}}
\headcommand {\beamer@sectionpages {12}{27}}
\headcommand {\beamer@subsectionpages {12}{27}}
\headcommand {\slideentry {4}{0}{28}{28/28}{}{0}}
\headcommand {\beamer@framepages {28}{28}}
\headcommand {\slideentry {4}{0}{29}{29/29}{}{0}}
\headcommand {\beamer@framepages {29}{29}}
\headcommand {\slideentry {4}{0}{30}{30/30}{}{0}}
\headcommand {\beamer@framepages {30}{30}}
\headcommand {\slideentry {4}{0}{31}{31/31}{}{0}}
\headcommand {\beamer@framepages {31}{31}}
\headcommand {\beamer@partpages {1}{31}}
\headcommand {\beamer@subsectionpages {28}{31}}
\headcommand {\beamer@sectionpages {28}{31}}
\headcommand {\beamer@documentpages {31}}
\headcommand {\def \inserttotalframenumber {31}}

View File

@ -0,0 +1,4 @@
\BOOKMARK [2][]{Outline0.1}{1. Aufgabe}{}% 1
\BOOKMARK [2][]{Outline0.2}{2. Aufgabe}{}% 2
\BOOKMARK [2][]{Outline0.3}{3. Aufgabe}{}% 3
\BOOKMARK [2][]{Outline0.4}{5. Aufgabe}{}% 4

View File

@ -0,0 +1,320 @@
\documentclass[colorback,accentcolor=tud1b]{tudbeamer}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\title{1 "Ubung}
\author{Ulf Gebhardt, Victor-Philipp Negoescu, Michael Scholz}
\date{\today}
\newcommand{\al}{\glqq}
\newcommand{\ar}{\grqq\ }
% % % % % % % % % % % % % % % % % % % % % % % 1. Folie % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % % %
\begin{document}
\begin{frame}
\frametitle{Web Mining \\ 2. "Ubung}
\textbf{Gruppe 22:}
\begin{itemize}
\item Ulf Gebhardt
\item Victor-Philipp Negoescu
\item Michael Scholz
\end{itemize}
\end{frame}
% % % % % % % % % % % % % % % % % % % % % % % 1. Aufgabe % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % % %
\section{1. Aufgabe}
\begin{frame}
\frametitle{1. Aufgabe \\ Aufgabenstellung}
"Uberlegen Sie sich eine neuartige, originelle Web Mining Anwendung, die mit Text-Klassifikationsverfahren gel"ost werden k"onnte. Skizzieren Sie eine m"ogliche Umsetzung (Sammlung der Trainingsdaten, Klassifikation der Trainingsdaten, Einsatz des gelernten Klassifikators in der Praxis). (2 Punkte)
\end{frame}
\begin{frame}
\frametitle{1. Aufgabe \\ L"osung}
Textbasiertes Klassifikationsverfahren für gecrawlte Produktrezensionen. \\
Einteilung in die Klassen:
\begin{itemize}
\item \textbf{Positiv:} \\
Rezension lobt das Produkt
\item \textbf{Neutral:} \\
Die Rezension besitzt keine eindeutige Tendenz
\item \textbf{Negativ:} \\
Die Rezension kritisiert das Produkt
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{1. Aufgabe \\ L"osung}
\textbf{Sammlung von Trainingsdaten:}
\begin{itemize}
\item Produktrezensionen enthalten meist Bewertung von 1 (sehr negativ) bis 5 (sehr positiv)
\item Zudem enthalten sie eine ausf"uhrliche Beschreibung
\item Trainingsdaten k"onnen automatisch durch einen Crawler gesammelt werden.
\item Crawler durchl"auft die DOM-Struktur oder verwendet API-Schnittstelle (falls vorhanden)
\end{itemize}
Ergebnis: \\
Zuordnung von Bewertungen (1-5) zu Rezension (Text)
\end{frame}
\begin{frame}
\frametitle{1. Aufgabe \\ L"osung}
\textbf{Klassifikation der Trainingsdaten:} \\
Zuweisung von Bewertung zu definierter Klasse:
\begin{itemize}
\item Bewertung \{1, 1.5, 2\}: Negativ
\item Bewertung \{2.5, 3, 3.5\}: Neutral
\item Bewertung \{4, 4.5, 5\}: Positiv
\end{itemize}
Gesammelte Trainingsdaten k"onnten nun entsprechend dieser Zuweisung in die passende Klasse eingeordnet werden.
\end{frame}
\begin{frame}
\frametitle{1. Aufgabe \\ L"osung}
\textbf{Einsatz des gelernten Klassifikators in der Praxis:}
\begin{itemize}
\item Unbekannte Texte, welche durch einen Vorverarbeitungsschritt als passend zu einem gegebenen Produkt erkannt wurden, k"onnen in die definierten drei Klassen eingeteilt werden.
\item Diese Methode k"onnte die Bewertung der "Offentlichkeit eines bestimmtes Produktes oder einer Marke quantitativ beschreiben, obwohl keine explizite quantitative Bewertung vorgenommen wurde.
\end{itemize}
\end{frame}
% % % % % % % % % % % % % % % % % % % % % % % 2. Aufgabe % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % % %
\section{2. Aufgabe}
\begin{frame}
\frametitle{2. Aufgabe \\ Aufgabenstellung}
Schreiben Sie ein einfaches Programm, das eine sortierte Liste der in einem Text vorkommenden Worte (im weitesten Sinn alles was durch Leerzeichen begrenzt wird) mit den assoziierten H"aufigkeiten (absolut und prozentual) erstellt und sortiert ausgibt. (2 Punkte)
\begin{itemize}
\item Vergleichen Sie die 30 am h"aufigsten vorkommenden Worte in zwei oder mehreren l"angeren Texten der gleichen Sprache (z.B. E-books, Projekt Gutenberg, etc.). Sind diese Worte als Merkmale f"ur Text-Klassifizierungs-Aufgaben geeignet? Warum?
\item Modifizieren Sie Ihr Programm dahingehend, dass es eine Liste von Stoppw"ortern erhalten kann, die ignoriert werden. Wiederholen Sie die vorherige Aufgabe, indem Sie jedoch diesmal die Stoppw"orter der jeweiligen Sprache ignorieren. Wie w"urden Sie nun die Eignung der 30 h"aufigisten W"orter einsch"atzen?
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{2. Aufgabe \\ L"osung}
Untersuchte Texte:
\begin{itemize}
\item {[}1{]} William Lewins. \textit{A Histroy of Banks for Saving in Great Britain and Ireland} (http://www.gutenberg.org/ebooks/42583)
\item {[}2{]} Amanda Minnie Douglas. \textit{A Little Girl in Old San Francisco} (http://www.gutenberg.org/ebooks/42582)
\item {[}3{]} James Curl. \textit{Expository Writing by Mervin} (http://www.gutenberg.org/ebooks/42580)
\item {[}4{]} Goswin Uphues.\textit{ Einf"uhrung in die moderne Logik. Erster Teil} (http://www.gutenberg.org/ebooks/24172)
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{2. Aufgabe \\ L"osung}
\begin{figure}
\noindent\includegraphics[height=5.5cm,keepaspectratio]{grafiken/a2_abb1.png}
\caption{Auflistung der 30 h"aufigsten W"orter (Texte {[}1{]} {[}2{]} {[}3{]})}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{2. Aufgabe \\ L"osung}
\begin{figure}
\noindent\includegraphics[height=5.5cm,keepaspectratio]{grafiken/a2_abb2.png}
\caption{Auflistung der 30 h"aufigsten W"orter ohne Stoppw"orter (Texte {[}1{]} {[}2{]} {[}3{]})}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{2. Aufgabe \\ L"osung}
\begin{itemize}
\item Liste der 30 h"aufigsten W"orter besteht fast ausschließlich aus Stoppw"ortern
\item Somit eignet sich die Liste der Stoppw"orter f"ur eine Spracherkennung
\item Nach Entfernung der Stoppw"orter bleiben noch einige generisch verwendete W"orter (\al banks\grqq, \al savings\grqq) "ubrig mit welchen man die Dom"ane der untersuchten Texte erkennen kann.
\end{itemize}
\end{frame}
% % % % % % % % % % % % % % % % % % % % % % % 3. Aufgabe % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % % %
\section{3. Aufgabe}
\begin{frame}
\frametitle{3. Aufgabe \\ Aufgabenstellung}
Die Auftrittswahrscheinlichkeiten von Worten in Texten folgen einer sogenannten Zipf-Verteilung, d.h. einer Verteilung, die doppelt logarithmisch ist. "Uberpr"ufen Sie das anhand der gew"ahlten Texte. (2 Punkte)
\begin{itemize}
\item Plotten Sie die H"aufigkeiten (y-Achse) "uber den Rang (X-Achse), also die Anzahl der Vorkommnisse des h"aufigsten Wortes zuerst, dann die Anzahl des zweith"aufigsten Wortes, etc. Betrachten Sie sowohl eine absolute als auch eine logarithmische Skalierung beider Achsen. Was k"onnen Sie beobachten?
\item Bestimmen Sie die Anzahl der Worte, die mit einer gegebenen H"aufigkeit vrkommen (also, wie viele W"orter gibt es, die mit H"aufigkeit 1 vorkommen, wie viele mit H"aufigkeit 2, etc.). Produzieren Sie "ahnliche Grafiken (Anzahl der Worte mit einer gewissen H"aufigkeit "uber die H"aufigkeit) und interpretieren Sie diese.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{3. Aufgabe \\ L"osung}
\begin{figure}
\noindent\includegraphics[height=5.5cm,keepaspectratio]{grafiken/a3_abb3.png}
\caption{Absolute Worth"aufigkeit (y) "uber Wortrang (x), beide Achsen linear}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{3. Aufgabe \\ L"osung}
\begin{itemize}
\item Auftrittswahrscheinlichkeit der W"orter nimmt zu schnell ab
\item Somit keine annehmbare Visualisierung mit linearer Achsenskalierung m"oglich
\item Y-Werte sammeln sich nahe dem Nullpunkt und konvergieren schon sehr fr"uh gegen null
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{3. Aufgabe \\ L"osung}
\begin{figure}
\noindent\includegraphics[height=5.5cm,keepaspectratio]{grafiken/a3_abb4.png}
\caption{Abs. Worth"aufigkeit (y) "uber Wortrang (x), beide Achsen logarithmisch}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{3. Aufgabe \\ L"osung}
\begin{itemize}
\item Durch logarithmische Skalierung beider Achsen ergibt sich eine ann"ahernd linear fallende Kurve der Auftrittswahrscheinlichkeiten
\item Dies ist typisch f"ur die Zipf-Verteilung
\item Es entspricht einem stark negativen exponentiellen Wachstum der Y-Werte
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{3. Aufgabe \\ L"osung}
\begin{figure}
\noindent\includegraphics[height=5.5cm,keepaspectratio]{grafiken/a3_abb5.png}
\caption{Anzahl der W"orter mit einer bestimmten Frequenz, Achsen linear}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{3. Aufgabe \\ L"osung}
\begin{figure}
\noindent\includegraphics[height=5.5cm,keepaspectratio]{grafiken/a3_abb6.png}
\caption{Anzahl der W"orter mit einer bestimmten Frequenz, Achsen logarithmisch}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{3. Aufgabe \\ L"osung}
F"ur die Anzahl der W"orter, die sich eine bestimmte Auftrittswahrscheinlichkeit teilen ergibt sich ein "ahnliches Bild wie zuvor gesehen. Je seltener ein Wort gebraucht wird (x -> 0), desto (exponentiell-)gr"oßer ist die Wahrscheinlichkeit, dass ein anderes Wort genauso oft vorkommt.
\end{frame}
% % % % % % % % % % % % % % % % % % % % % % % 4. Aufgabe % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % % %
\begin{frame}
\frametitle{4. Aufgabe \\ Aufgabenstellung}
Modifizieren Sie das Programm, so dass es nicht Worte sondern Buchstaben und Buchstabenpaare z"ahlt. Vergleichen Sie deren H"aufigkeitsverteilung sowohl zweier in der gleichen Sprache verfassten Texte als auch zweier in verschiedenen Sprachen abgefasster Texte. (2 Punkte)
\end{frame}
\begin{frame}
\frametitle{4. Aufgabe \\ L"osung}
\begin{figure}
\noindent\includegraphics[height=5.5cm,keepaspectratio]{grafiken/a4_abb7.png}
\caption{10 h"aufigsten Buchstaben und -paare (Text {[}1{], englischer Text)}}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{4. Aufgabe \\ L"osung}
\begin{figure}
\noindent\includegraphics[height=5.5cm,keepaspectratio]{grafiken/a4_abb8.png}
\caption{10 h"aufigsten Buchstaben und -paare (Text {[}2{], englischer Text)}}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{4. Aufgabe \\ L"osung}
Die beiden vorherigen Abbildungen zeigen, dass sich f"ur englischsprachige Texte "ahnliche Verteilungen der Buchstaben und Buchstabenpaare ergeben. Dies "andert sich bei der Analyse eines deutschen Textes (nachfolgende Folie).
\end{frame}
\begin{frame}
\frametitle{4. Aufgabe \\ L"osung}
\begin{figure}
\noindent\includegraphics[height=5.5cm,keepaspectratio]{grafiken/a4_abb9.png}
\caption{10 h"aufigsten Buchstaben und -paare (Text {[}4{], deutscher Text)}}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{4. Aufgabe \\ L"osung}
\begin{figure}
\noindent\includegraphics[height=5.5cm,keepaspectratio]{grafiken/a4_abb10.png}
\caption{Abs. Buchstabenh"aufigkeiten (y) "uber Rang (x), Achsen logarithmisch (Text {[}1{])}}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{4. Aufgabe \\ L"osung}
\begin{figure}
\noindent\includegraphics[height=5.5cm,keepaspectratio]{grafiken/a4_abb11.png}
\caption{Abs. Buchstabenh"aufigkeiten (y) "uber Rang (x), Achsen logarithmisch (Text {[}4{])}}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{4. Aufgabe \\ L"osung}
Aus den vorherigen Betrachtungen wurde deutlich, dass die h"aufigsten Buchstaben sich in verschiedenen Sprachen (hier: englisch und deutsch) unterscheiden. Betrachtet man nun die Verteilung des Verlaufs der Auftrittswahrscheinlichkeiten, ergibt sich daf"ur sowohl im englischen als auch im deutschen Text erneut die Zipf-Verteilung.
\end{frame}
% % % % % % % % % % % % % % % % % % % % % % % 5. Aufgabe % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % % % %
\section{5. Aufgabe}
\begin{frame}
\frametitle{5. Aufgabe \\ Aufgabenstellung}
Laden Sie sich unser kleiner Firefox-Plugin herunter und machen Sie dich damit und den Entwicklungstools vertraut. Weiter unten finden Sie Hinweise zur Verwendung. Erweitern Sie die Funktion \textit{student(text)} in der Datei \textit{lib/student.js} dahingehend, dass es drei Sprachen erkennen kann. Die Liste der bisher unterst"utzten Sprachen k"onnen Sie gernen in \textit{languages.js} nach Belieben erweitern. Verwenden Sie f"ur die Spracherkennung eine einfache Heuristik, die z.B. auf den in der vorherigen Aufgabe vorgestellen Stoppw"ortern basiert. Browsen Sie dann ein wenig im Wem herum und berichten uns von Ihren Ergebnissen und Erfahrungen mit dem Plugin. (1 Punkt)
\end{frame}
\begin{frame}
\frametitle{5. Aufgabe \\ L"osung}
Anpassungen in \textit{utility.js}:
\begin{itemize}
\item Erstelle Funktionen \textit{getDeStopwords()\{...\}}, \textit{getEnStopwords()\{...\}} und \textit{getFrStopwords()\{...\}}, welche die dazugeh"origen Stoppw"orter in Form eines Arrays zur"uckgeben
\item Erstelle Funktion \textit{arrayContains(array, element)\{...\}}, welche pr"uft ob sich das gegebene Element im gegebenen Array befindet
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{5. Aufgabe \\ L"osung}
Anpassungen in \textit{student.js}:
\begin{itemize}
\item Zerlege Text in Tokens
\item Erstelle Variablen zum Z"ahlen der deutschen, englischen und franz"osischen W"orter im Text.
\item Pr"ufe nun jedes Token ob es in den sprachspezifischen Stoppw"ortern vorkommt. Ist dies der Fall -> erh"ohe die dazuge"ohrige Variable um 1. \\
Nutze hierf"ur die zuvor in \textit{utility.js} definierten Funktionen.
\item Gebe die Sprache zur"uck deren Z"ahlvariable den h"ochsten Wert hat.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{5. Aufgabe \\ L"osung}
Ergebnisse:
\begin{itemize}
\item Einfache \al Z"ahlheuristik\ar funktioniert zuverl"assig
\item Alle besuchten Webseiten wurden richtig erkannt
\item Bug im Addon? \\
Nutzt man im Browser mehrere Tabs, so zeigt das Addon beim Wechsel des Tabs immer die Sprache der zuletzt geladenen Webseite an.
\end{itemize}
\end{frame}
\end{document}

View File

@ -0,0 +1,6 @@
\beamer@endinputifotherversion {3.12pt}
\select@language {ngerman}
\beamer@sectionintoc {1}{1. Aufgabe}{2}{0}{1}
\beamer@sectionintoc {2}{2. Aufgabe}{7}{0}{2}
\beamer@sectionintoc {3}{3. Aufgabe}{12}{0}{3}
\beamer@sectionintoc {4}{5. Aufgabe}{28}{0}{4}