11.02.2013 Aufrufe

Aspekte der morphologischen Analyse des Deutschen - Universität ...

Aspekte der morphologischen Analyse des Deutschen - Universität ...

Aspekte der morphologischen Analyse des Deutschen - Universität ...

MEHR ANZEIGEN
WENIGER ANZEIGEN

Erfolgreiche ePaper selbst erstellen

Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.

Anhang C: Programmcode<br />

/*********************************************************************************************************************************<br />

complete_chart(Word:)<br />

Check whether is's necessary to insert "unknown" segments<br />

at the end of the chart<br />

*********************************************************************************************************************************/<br />

complete_chart(Word) :-<br />

atom_length(Word,WordLen),<br />

add_unknown_segments(WordLen,Word).<br />

/*********************************************************************************************************************************<br />

closure(Begin:,End:,Cat:,Closed:,<br />

Open:,Positions:,Conditions)<br />

Depending on the active/inactive status the edge is either expanded or<br />

used to complete other edges<br />

*********************************************************************************************************************************/<br />

closure(Begin,End,Cat,RHS,[],Positions,Conditions) :- % inactive edge<br />

store(edge(Begin,End,Cat,RHS,[],Positions,Conditions)),<br />

% try to complete active edges with the inactive one<br />

complete(Begin,End,Cat).<br />

closure(Begin,End,Cat,Closed,[Next|Rest],Positions,Conditions) :- % active edge<br />

store(edge(Begin,End,Cat,Closed,[Next|Rest],Positions,Conditions)),<br />

expand(End,Next).<br />

/*********************************************************************************************************************************<br />

complete(Begin:,End:,CompleteCat:)<br />

tries to extend active edges waiting for CompleteCat<br />

*********************************************************************************************************************************/<br />

complete(Begin,End,Cat) :-<br />

edge(Begin0,Begin,LHS,Closed0,[Cat|Open],Positions,Conditions),<br />

append(Closed0,[Cat],Closed), % move the dot to the right<br />

append(Positions,[End],NewPositions),<br />

closure(Begin0,End,LHS,Closed,Open,NewPositions,Conditions),<br />

fail.<br />

complete(_Begin,_End,_Cat).<br />

/*********************************************************************************************************************************<br />

expand(Position:,LHS:)<br />

asserts an active edge for every rule starting with LHS<br />

*********************************************************************************************************************************/<br />

expand(Position,LHS) :-<br />

% find a suitable phrase/word structure rule<br />

applicable_rule(LHS,RHS,Conditions),<br />

closure(Position,Position,LHS,[],RHS,[],Conditions),<br />

fail.<br />

expand(_Position,_LHS).<br />

/*********************************************************************************************************************************<br />

applicable_rule(LHS:,RHS:,Conditions:):<br />

Looks for a applicable rule<br />

*********************************************************************************************************************************/<br />

applicable_rule(LHS,RHS,Conditions) :-<br />

(rule (LHS ==> RHS) conditions Conditions).<br />

/*********************************************************************************************************************************<br />

store(Edge:)<br />

Version without subsumptions check<br />

store(edge(Begin,End,Cat,Closed,Open,Positions)) :-<br />

\+ edge(Begin,End,Cat,Closed,Open,Positions),<br />

assert(edge(Begin,End,Cat,Closed,Open,Positions)).<br />

*********************************************************************************************************************************/<br />

204

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!