You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
613 lines
25 KiB
HTML
613 lines
25 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html>
|
|
<head>
|
|
<title>pattern-it</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<link type="text/css" rel="stylesheet" href="../clips.css" />
|
|
<style>
|
|
/* Small fixes because we omit the online layout.css. */
|
|
h3 { line-height: 1.3em; }
|
|
#page { margin-left: auto; margin-right: auto; }
|
|
#header, #header-inner { height: 175px; }
|
|
#header { border-bottom: 1px solid #C6D4DD; }
|
|
table { border-collapse: collapse; }
|
|
#checksum { display: none; }
|
|
</style>
|
|
<link href="../js/shCore.css" rel="stylesheet" type="text/css" />
|
|
<link href="../js/shThemeDefault.css" rel="stylesheet" type="text/css" />
|
|
<script language="javascript" src="../js/shCore.js"></script>
|
|
<script language="javascript" src="../js/shBrushXml.js"></script>
|
|
<script language="javascript" src="../js/shBrushJScript.js"></script>
|
|
<script language="javascript" src="../js/shBrushPython.js"></script>
|
|
</head>
|
|
<body class="node-type-page one-sidebar sidebar-right section-pages">
|
|
<div id="page">
|
|
<div id="page-inner">
|
|
<div id="header"><div id="header-inner"></div></div>
|
|
<div id="content">
|
|
<div id="content-inner">
|
|
<div class="node node-type-page"
|
|
<div class="node-inner">
|
|
<div class="breadcrumb">View online at: <a href="http://www.clips.ua.ac.be/pages/pattern-it" class="noexternal" target="_blank">http://www.clips.ua.ac.be/pages/pattern-it</a></div>
|
|
<h1>pattern.it</h1>
|
|
<!-- Parsed from the online documentation. -->
|
|
<div id="node-1698" class="node node-type-page"><div class="node-inner">
|
|
<div class="content">
|
|
<p><span class="big">The pattern.it module contains a fast part-of-speech tagger for Italian (identifies nouns, adjectives, verbs, etc. in a sentence) and tools for Italian verb conjugation and noun singularization & pluralization.</span></p>
|
|
<p>It can be used by itself or with other <a href="pattern.html">pattern</a> modules: <a href="pattern-web.html">web</a> | <a href="pattern-db.html">db</a> | <a href="pattern-en.html">en</a> | <a href="pattern-search.html">search</a> | <a href="pattern-vector.html">vector</a> | <a href="pattern-graph.html">graph</a>.</p>
|
|
<p><img src="../g/pattern_schema_it.gif" alt="" /></p>
|
|
<hr />
|
|
<h2>Documentation</h2>
|
|
<p>The functions in this module take the same parameters and return the same values as their counterparts in <a href="pattern-en.html">pattern.en</a>. Refer to the documentation there for more details. </p>
|
|
<h3>Gender</h3>
|
|
<p>Italian nouns and adjectives inflect according to gender. The <span class="inline_code">gender()</span> function predicts the gender (<span class="inline_code">MALE</span>, <span class="inline_code">FEMALE</span>, <span class="inline_code">PLURAL</span>) of a given noun with about 92% accuracy: </p>
|
|
<div class="example">
|
|
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">>>> from pattern.it import gender, MALE, FEMALE, PLURAL
|
|
>>> print gender('gatti')
|
|
|
|
(MALE, PLURAL)</pre></div>
|
|
<h3>Article</h3>
|
|
<p>The <span class="inline_code">article()</span> function returns the article (<span class="inline_code">INDEFINITE</span> or <span class="inline_code">DEFINITE</span>) inflected by gender (e.g., <em><span style="text-decoration: underline;">il</span> gatto</em> → <em><span style="text-decoration: underline;">i</span> gatti</em>).</p>
|
|
<div class="example">
|
|
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">>>> from pattern.it import article, DEFINITE, MALE, PLURAL
|
|
>>> print article('gatti', DEFINITE, gender=(MALE, PLURAL))
|
|
|
|
i</pre></div>
|
|
<h3>Noun singularization & pluralization</h3>
|
|
<p>For Italian nouns there is <span class="inline_code">singularize()</span> and <span class="inline_code">pluralize()</span>. The implementation is slightly less robust than the English version (accuracy 84% for singularization and 93% for pluralization).</p>
|
|
<div class="example">
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.it import singularize, pluralize
|
|
>>>
|
|
>>> print singularize('gatti')
|
|
>>> print pluralize('gatto')
|
|
|
|
gatto
|
|
gatti </pre></div>
|
|
<h3>Verb conjugation</h3>
|
|
<p>For Italian verbs there is <span class="inline_code">conjugate()</span>, <span class="inline_code">lemma()</span>, <span class="inline_code">lexeme()</span> and <span class="inline_code">tenses()</span>. The lexicon for verb conjugation contains about 1,250 common Italian verbs, mined from Wiktionary. For unknown verbs it will fall back to a rule-based approach with an accuracy of about 86%. </p>
|
|
<p>Italian verbs have more tenses than English verbs. In particular, the plural differs for each person, and there are additional forms for the <span class="inline_code">FUTURE</span> tense, the <span class="inline_code">IMPERATIVE</span>, <span class="inline_code">CONDITIONAL</span> and <span class="inline_code">SUBJUNCTIVE</span> mood and the <span class="inline_code">PERFECTIVE</span> aspect:</p>
|
|
<div class="example">
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.it import conjugate
|
|
>>> from pattern.it import INFINITIVE, PRESENT, PAST, SG, SUBJUNCTIVE, PERFECTIVE
|
|
>>>
|
|
>>> print conjugate('sono', INFINITIVE)
|
|
>>> print conjugate('sono', PRESENT, 1, SG, mood=SUBJUNCTIVE)
|
|
>>> print conjugate('sono', PAST, 3, SG)
|
|
>>> print conjugate('sono', PAST, 3, SG, aspect=PERFECTIVE)
|
|
|
|
essere
|
|
sia
|
|
era
|
|
fu </pre></div>
|
|
<p>For <span class="inline_code">PAST</span> tense + <span class="inline_code">PERFECTIVE</span> aspect we can also use <span class="inline_code">PRETERITE</span> (<em>passato remoto</em>) For <span class="inline_code">PAST</span> tense + <span class="inline_code">IMPERFECTIVE</span> aspect we can also use <span class="inline_code">IMPERFECT</span> (<em>imperfetto</em>).</p>
|
|
<div class="example">
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.it import conjugate
|
|
>>> from pattern.it import IMPERFECT, PRETERITE
|
|
>>>
|
|
>>> print conjugate('sono', IMPERFECT, 3, SG)
|
|
>>> print conjugate('sono', PRETERITE, 3, SG)
|
|
|
|
era
|
|
fu </pre></div>
|
|
<p> The <span class="inline_code">conjugate()</span> function takes the following optional parameters:</p>
|
|
<table class="border">
|
|
<tbody>
|
|
<tr>
|
|
<td class="smallcaps">Tense</td>
|
|
<td class="smallcaps">Person</td>
|
|
<td class="smallcaps">Number</td>
|
|
<td class="smallcaps">Mood</td>
|
|
<td class="smallcaps">Aspect</td>
|
|
<td class="smallcaps">Alias</td>
|
|
<td class="smallcaps">Example</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">INFINITVE</td>
|
|
<td class="inline_code">None</td>
|
|
<td class="inline_code">None</td>
|
|
<td class="inline_code">None</td>
|
|
<td class="inline_code">None</td>
|
|
<td class="inline_code">"inf"</td>
|
|
<td><em>essere</em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1sg"</td>
|
|
<td><em>io <span style="text-decoration: underline;">sono</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2sg"</td>
|
|
<td><em>tu <span style="text-decoration: underline;">sei</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3sg"</td>
|
|
<td><em>lui <span style="text-decoration: underline;">è</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1pl"</td>
|
|
<td><em>noi <span style="text-decoration: underline;">siamo</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2pl"</td>
|
|
<td><em>voi <span style="text-decoration: underline;">siete</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3pl"</td>
|
|
<td><em>loro <span style="text-decoration: underline;">sono</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">None</td>
|
|
<td class="inline_code">None</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">PROGRESSIVE</td>
|
|
<td class="inline_code">"part"</td>
|
|
<td><em>essendo</em></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-left: 0; border-right: 0; padding: 0;"> </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">IMPERATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2sg!"</td>
|
|
<td><em>sii</em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">IMPERATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3sg!"</td>
|
|
<td><em>sia</em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">IMPERATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1pl!"</td>
|
|
<td><em>siamo</em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">IMPERATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2pl!"</td>
|
|
<td><em>siate</em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">IMPERATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3pl!"</td>
|
|
<td><em>siano</em></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-left: 0; border-right: 0; padding: 0;"> </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1sg?"</td>
|
|
<td><em>io <span style="text-decoration: underline;">sia</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2sg?"</td>
|
|
<td><em>tu <span style="text-decoration: underline;">sia</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3sg?"</td>
|
|
<td><em>lui <span style="text-decoration: underline;">sia</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1pl?"</td>
|
|
<td><em>noi <span style="text-decoration: underline;">siamo</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2pl?"</td>
|
|
<td><em>voi <span style="text-decoration: underline;">siate</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PRESENT</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3pl?"</td>
|
|
<td><em>loro <span style="text-decoration: underline;">siano</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-left: 0; border-right: 0; padding: 0;"> </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1sgp"</td>
|
|
<td><em>io <span style="text-decoration: underline;">ero</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2sgp"</td>
|
|
<td><em>tu <span style="text-decoration: underline;">eri</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3sgp"</td>
|
|
<td><em>lui <span style="text-decoration: underline;">era</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1ppl"</td>
|
|
<td><em>noi <span style="text-decoration: underline;">e</span><span style="text-decoration: underline;">ravamo</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2ppl"</td>
|
|
<td><em>voi <span style="text-decoration: underline;">eravate</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3ppl"</td>
|
|
<td><em>loro <span style="text-decoration: underline;">erano</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">None</td>
|
|
<td class="inline_code">None</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">PROGRESSIVE</td>
|
|
<td class="inline_code">"ppart"</td>
|
|
<td><em>stato</em></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-left: 0; border-right: 0; padding: 0;"> </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">PERFECTIVE</td>
|
|
<td class="inline_code">"1sgp+"</td>
|
|
<td><em>io <span style="text-decoration: underline;">fui</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">PERFECTIVE</td>
|
|
<td class="inline_code">"2sgp+"</td>
|
|
<td><em>tu <span style="text-decoration: underline;">fosti</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">PERFECTIVE</td>
|
|
<td class="inline_code">"3sgp+"</td>
|
|
<td><em>lui <span style="text-decoration: underline;">fu</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">PERFECTIVE</td>
|
|
<td class="inline_code">"1ppl+"</td>
|
|
<td><em>noi <span style="text-decoration: underline;">fummo</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">PERFECTIVE</td>
|
|
<td class="inline_code">"2ppl+"</td>
|
|
<td><em>voi <span style="text-decoration: underline;">foste</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">PERFECTIVE</td>
|
|
<td class="inline_code">"3ppl+"</td>
|
|
<td><em>loro <span style="text-decoration: underline;">furono</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-left: 0; border-right: 0; padding: 0;"> </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1sgp?"</td>
|
|
<td><em>io <span style="text-decoration: underline;">fossi</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2sgp?"</td>
|
|
<td><em>tu <span style="text-decoration: underline;">fossi</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3sgp?"</td>
|
|
<td><em>lui <span style="text-decoration: underline;">fosse</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1ppl?"</td>
|
|
<td><em>noi <span style="text-decoration: underline;">fossimo</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2ppl?"</td>
|
|
<td><em>voi <span style="text-decoration: underline;">foste</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">PAST</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">SUBJUNCTIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3ppl?"</td>
|
|
<td><em>loro <span style="text-decoration: underline;">fossero</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-left: 0; border-right: 0; padding: 0;"> </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">FUTURE</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1sgf"</td>
|
|
<td><em>io <span style="text-decoration: underline;">sarò</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">FUTURE</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2sgf"</td>
|
|
<td><em>tu <span style="text-decoration: underline;">sarai</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">FUTURE</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3sgf"</td>
|
|
<td><em>lui <span style="text-decoration: underline;">sarà</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">FUTURE</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1plf"</td>
|
|
<td><em>noi <span style="text-decoration: underline;">saremo</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">FUTURE</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2plf"</td>
|
|
<td><em>voi <span style="text-decoration: underline;">sarete</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">FUTURE</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3plf"</td>
|
|
<td><em>loro <span style="text-decoration: underline;">saranno</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="border-left: 0; border-right: 0; padding: 0;"> </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">CONDITIONAL</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1sg->"</td>
|
|
<td><em>io <span style="text-decoration: underline;">sarei</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">CONDITIONAL</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2sg->"</td>
|
|
<td><em>tu <span style="text-decoration: underline;">saresti</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">CONDITIONAL</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">SG</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3sg->"</td>
|
|
<td><em>lui <span style="text-decoration: underline;">sarebbe</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">CONDITIONAL</td>
|
|
<td class="inline_code">1</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"1pl->"</td>
|
|
<td><em>noi <span style="text-decoration: underline;">saremmo</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">CONDITIONAL</td>
|
|
<td class="inline_code">2</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"2pl->"</td>
|
|
<td><em>voi <span style="text-decoration: underline;">sareste</span></em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="inline_code">CONDITIONAL</td>
|
|
<td class="inline_code">3</td>
|
|
<td class="inline_code">PL</td>
|
|
<td class="inline_code">INDICATIVE</td>
|
|
<td class="inline_code">IMPERFECTIVE</td>
|
|
<td class="inline_code">"3pl->"</td>
|
|
<td><em>loro <span style="text-decoration: underline;">sarebbero</span></em></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>Instead of optional parameters, a single short alias, or <span class="inline_code">PARTICIPLE</span> or <span class="inline_code">PAST+PARTICIPLE</span> can also be given. With no parameters, the infinitive form of the verb is returned.</p>
|
|
<h3>Attributive & predicative adjectives </h3>
|
|
<p>Italian adjectives inflect with suffixes <span class="inline_code">-o</span> → <span class="inline_code">-i</span> (masculine) and <span class="inline_code">-a</span> → <span class="inline_code">-e</span> (feminine), with some exceptions (e.g., <em>grande</em> → <em>i grandi felini</em>). You can get the base form with the <span class="inline_code">predicative()</span> function. A statistical approach is used with an accuracy of 88%.</p>
|
|
<div class="example">
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.it import attributive
|
|
>>> print predicative('grandi')
|
|
|
|
grande </pre></div>
|
|
<h3>Parser</h3>
|
|
<p>For parsing there is <span class="inline_code" style="font-family: Courier, monospace; font-size: 12px;">parse()</span>, <span class="inline_code">parsetree()</span> and <span class="inline_code" style="font-family: Courier, monospace; font-size: 12px;">split()</span>. The <span class="inline_code">parse()</span> function annotates words in the given string with their part-of-speech <a class="link-maintenance" href="mbsp-tags.html">tags</a> (e.g., <span class="postag">NN</span> for nouns and <span class="postag">VB</span> for verbs). The <span class="inline_code">parsetree()</span> function takes a string and returns a tree of nested objects (<span class="inline_code">Text</span> → <span class="inline_code">Sentence</span> → <span class="inline_code">Chunk</span> → <span class="inline_code">Word</span>). The <span class="inline_code">split()</span> function takes the output of <span class="inline_code">parse()</span> and returns a <span class="inline_code">Text</span>. See the <span class="inline_code">pattern.en</span> documentation (<span class="link-maintenance" style="color: #78aaff;"><a style="color: #8caaff; outline-style: none !important; outline-width: initial !important; outline-color: initial !important;" href="pattern-en.html#tree">here</a></span>) how to manipulate <span class="inline_code">Text</span> objects. </p>
|
|
<div class="example">
|
|
<pre class="brush:python; gutter:false; light:true;">>>> from pattern.it import parse, split
|
|
>>>
|
|
>>> s = parse('Il gatto nero faceva le fusa.')
|
|
>>> for sentence in split(s):
|
|
>>> print sentence
|
|
|
|
Sentence('Il/DT/B-NP/O gatto/NN/I-NP/O nero/JJ/I-NP/O'
|
|
'faceva/VB/B-VP/O'
|
|
'le/DT/B-NP/O fusa/NN/I-NP/O ././O/O')
|
|
</pre></div>
|
|
<p>The parser is mined from Wiktionary. The accuracy is around 92%.</p>
|
|
<h3>Sentiment analysis</h3>
|
|
<p>There's no <span class="inline_code">sentiment()</span> function for Italian yet.</p>
|
|
</div>
|
|
</div></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
SyntaxHighlighter.all();
|
|
</script>
|
|
</body>
|
|
</html> |