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.

590 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-fr</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-fr" class="noexternal" target="_blank">http://www.clips.ua.ac.be/pages/pattern-fr</a></div>
<h1>pattern.fr</h1>
<!-- Parsed from the online documentation. -->
<div id="node-1697" class="node node-type-page"><div class="node-inner">
<div class="content">
<p><span class="big">The pattern.fr module contains a fast part-of-speech tagger for French (identifies nouns, adjectives, verbs, etc. in a sentence), sentiment analysis, and tools for French verb conjugation and noun singularization &amp; pluralization.</span></p>
<p>It can be used by itself or with other&nbsp;<a href="pattern.html">pattern</a>&nbsp;modules:&nbsp;<a href="pattern-web.html">web</a>&nbsp;|&nbsp;<a href="pattern-db.html">db</a>&nbsp;| <a href="pattern-en.html">en</a>&nbsp;|&nbsp;<a href="pattern-search.html">search</a>&nbsp;|&nbsp;<a href="pattern-vector.html">vector</a>&nbsp;|&nbsp;<a href="pattern-graph.html">graph</a>.</p>
<p><img src="../g/pattern_schema_fr.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.&nbsp;&nbsp;</p>
<h3>Noun singularization &amp; pluralization</h3>
<p>For French nouns there is <span class="inline_code">singularize()</span> and <span class="inline_code">pluralize()</span>.&nbsp;The implementation uses a statistical approach with 93% accuracy for singularization and 92% for pluralization.</p>
<div class="example">
<pre class="brush:python; gutter:false; light:true;">&gt;&gt;&gt; from pattern.fr import singularize, pluralize
&gt;&gt;&gt;
&gt;&gt;&gt; print singularize('chats')
&gt;&gt;&gt; print pluralize('chat')
chat
chats </pre></div>
<h3>Verb conjugation</h3>
<p>For French 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>.&nbsp;The lexicon for verb conjugation contains about 1,750 common French verbs (constructed with Bob Salita's verb conjugation rules).&nbsp;For unknown verbs it will fall back to regular expressions with an accuracy of about 83%.&nbsp;</p>
<p>French verbs have more tenses than English verbs. In particular, the plural differs for each person, and there are additional forms for the&nbsp;<span class="inline_code">FUTURE</span>&nbsp;tense, the&nbsp;<span class="inline_code">IMPERATIVE</span>, <span class="inline_code">CONDITIONAL</span> and&nbsp;<span class="inline_code">SUBJUNCTIVE</span>&nbsp;mood and the&nbsp;<span class="inline_code">PERFECTIVE</span>&nbsp;aspect:</p>
<div class="example">
<pre class="brush:python; gutter:false; light:true;">&gt;&gt;&gt; from pattern.fr import conjugate
&gt;&gt;&gt; from pattern.fr import INFINITIVE, PRESENT, PAST, SG, SUBJUNCTIVE, PERFECTIVE
&gt;&gt;&gt;
&gt;&gt;&gt; print conjugate('suis', INFINITIVE)
&gt;&gt;&gt; print conjugate('suis', PRESENT, 1, SG, mood=SUBJUNCTIVE)
&gt;&gt;&gt; print conjugate('suis', PAST, 3, SG)
&gt;&gt;&gt; print conjugate('suis', PAST, 3, SG, aspect=PERFECTIVE)
être
sois
était
fut </pre></div>
<p>For <span class="inline_code">PAST</span>&nbsp;tense + <span class="inline_code">PERFECTIVE</span>&nbsp;aspect we can also use <span class="inline_code">PRETERITE</span>&nbsp;(<em>passé simple</em>). For <span class="inline_code">PAST</span>&nbsp;tense + <span class="inline_code">IMPERFECTIVE</span>&nbsp;aspect we can also use <span class="inline_code">IMPERFECT</span>&nbsp;(<em>imparfait</em>):</p>
<div class="example">
<pre class="brush:python; gutter:false; light:true;">&gt;&gt;&gt; from pattern.fr import conjugate
&gt;&gt;&gt; from pattern.fr import IMPERFECT, PRETERITE
&gt;&gt;&gt;
&gt;&gt;&gt; print conjugate('suis', IMPERFECT, 3, SG)
&gt;&gt;&gt; print conjugate('suis', PRETERITE, 3, SG)
était
fut </pre></div>
<p>&nbsp;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>être</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>je&nbsp;<span style="text-decoration: underline;">suis</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&nbsp;<span style="text-decoration: underline;">es</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>il&nbsp;<span style="text-decoration: underline;">est</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>nous&nbsp;<span style="text-decoration: underline;">sommes</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>vous&nbsp;<span style="text-decoration: underline;">êtes</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>ils&nbsp;<span style="text-decoration: underline;">sont</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>étant</em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</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>sois</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>soyons</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>soyez</em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</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">CONDITIONAL</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1sg-&gt;"</td>
<td><em>je&nbsp;<span style="text-decoration: underline;">serais</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">CONDITIONAL</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2sg-&gt;"</td>
<td><em>tu&nbsp;<span style="text-decoration: underline;">serais</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">CONDITIONAL</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3sg-&gt;"</td>
<td><em>il&nbsp;<span style="text-decoration: underline;">serait</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">CONDITIONAL</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"1pl-&gt;"</td>
<td><em>nous&nbsp;<span style="text-decoration: underline;">serions</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">CONDITIONAL</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"2pl-&gt;"</td>
<td><em>vous&nbsp;<span style="text-decoration: underline;">seriez</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">CONDITIONAL</td>
<td class="inline_code">IMPERFECTIVE</td>
<td class="inline_code">"3pl-&gt;"</td>
<td><em>ils&nbsp;<span style="text-decoration: underline;">seraient</span></em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</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>je&nbsp;<span style="text-decoration: underline;">sois</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&nbsp;<span style="text-decoration: underline;">sois</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>il&nbsp;<span style="text-decoration: underline;">soit</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>nous&nbsp;<span style="text-decoration: underline;">soyons</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>vous&nbsp;<span style="text-decoration: underline;">soyez</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>ils&nbsp;<span style="text-decoration: underline;">soient</span></em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</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>j'&nbsp;<span style="text-decoration: underline;">étais</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&nbsp;<span style="text-decoration: underline;">étais</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>il&nbsp;<span style="text-decoration: underline;">était</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>nous&nbsp;<span style="text-decoration: underline;">étions</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>vous&nbsp;<span style="text-decoration: underline;">étiez</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>ils&nbsp;<span style="text-decoration: underline;">étaient</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>été</em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</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>je&nbsp;<span style="text-decoration: underline;">fus</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&nbsp;<span style="text-decoration: underline;">fus</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>il&nbsp;<span style="text-decoration: underline;">fut</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>nous&nbsp;<span style="text-decoration: underline;">fûmes</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>vous&nbsp;<span style="text-decoration: underline;">fûtes</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>ils&nbsp;<span style="text-decoration: underline;">furent</span></em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</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>je&nbsp;<span style="text-decoration: underline;">fusse</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&nbsp;<span style="text-decoration: underline;">fusses</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>il&nbsp;<span style="text-decoration: underline;">fût</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>nous&nbsp;<span style="text-decoration: underline;">fussions</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>vous&nbsp;<span style="text-decoration: underline;">fussiez</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>ils&nbsp;<span style="text-decoration: underline;">fussent</span></em></td>
</tr>
<tr>
<td style="border-left: 0; border-right: 0; padding: 0;">&nbsp;</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>je&nbsp;<span style="text-decoration: underline;">serai</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&nbsp;<span style="text-decoration: underline;">seras</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>il&nbsp;<span style="text-decoration: underline;">sera</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>nous&nbsp;<span style="text-decoration: underline;">serons</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>vous&nbsp;<span style="text-decoration: underline;">serez</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>ils&nbsp;<span style="text-decoration: underline;">seron</span></em></td>
</tr>
</tbody>
</table>
<p>Instead of optional parameters, a single short alias, or&nbsp;<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>
<p class="small"><span style="text-decoration: underline;">Reference</span><span>: Salita, B. (2011).&nbsp;<em>French Verb Conjugation Rules</em>. Retrieved from:&nbsp;</span><span><a class="noexternal" style="color: inherit;" href="http://fvcr.sourceforge.net/" target="_blank">http://fvcr.sourceforge.net</a>.</span></p>
<h3>Attributive &amp; predicative adjectives&nbsp;</h3>
<p>French adjectives inflect with an <span class="inline_code">-e</span>,&nbsp;<span class="inline_code">-s</span>&nbsp; or&nbsp;<span class="inline_code">-es</span>&nbsp;suffix depending on gender. There are many irregular cases (e.g., <em>curieux</em>&nbsp;<em>une fille curieuse</em>). You can get the base form with the <span class="inline_code">predicative()</span> function.&nbsp;A statistical approach is used with an accuracy of 95%.</p>
<div class="example">
<pre class="brush:python; gutter:false; light:true;">&gt;&gt;&gt; from pattern.fr import predicative
&gt;&gt;&gt; print predicative('curieuse')
curieux </pre></div>
<h3>Sentiment analysis</h3>
<p class="example">For opinion mining there is <span class="inline_code">sentiment()</span>, which returns a (<span class="inline_code">polarity</span>, <span class="inline_code">subjectivity</span>)-tuple, based on a lexicon of adjectives. Polarity is a value between <span class="inline_code">-1.0</span> and <span class="inline_code">+1.0</span>, subjectivity between <span class="inline_code">0.0</span> and <span class="inline_code">1.0</span>. The accuracy is around 74% (P 0.77, R 0.73) for book reviews:</p>
<div class="example">
<pre class="brush:python; gutter:false; light:true;">&gt;&gt;&gt; from pattern.fr import sentiment
&gt;&gt;&gt; print sentiment('Un livre magnifique!')
(1.0, 1.0) </pre></div>
<h3>Parser</h3>
<p>For parsing there is <span class="inline_code">parse()</span>, <span class="inline_code">parsetree()</span> and&nbsp;<span class="inline_code">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>&nbsp;(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>&nbsp;<span class="inline_code">Sentence</span>&nbsp;<span class="inline_code">Chunk</span>&nbsp;<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>.&nbsp;See the <span class="inline_code">pattern.en</span> documentation&nbsp;(<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>&nbsp;objects.&nbsp;</p>
<div class="example">
<pre class="brush:python; gutter:false; light:true;">&gt;&gt;&gt; from pattern.fr import parse, split
&gt;&gt;&gt;
&gt;&gt;&gt; s = parse(u"Le chat noir s'était assis sur le tapis.")
&gt;&gt;&gt; for sentence in split(s):
&gt;&gt;&gt; print sentence
Sentence('Le/DT/B-NP/O chat/NN/I-NP/O noir/JJ/I-NP/O'
"s'/PRP/B-NP/O était/VB/B-VP/O assis/VBN/I-VP/O"
'sur/IN/B-PP/B-PNP le/DT/B-NP/I-PNP tapis/NN/I-NP/I-PNP ././O/O')
</pre></div>
<p>The parser is based on <a href="http://alpage.inria.fr/~sagot/lefff-en.html">Le<em>fff</em></a>. For words in Le<em>fff</em> that can have multiple part-of-speech tags, we used <a href="http://www.lexique.org/">Lexique</a> to find the most frequent POS-tag.&nbsp;</p>
<p class="small"><span style="text-decoration: underline;">References</span>:&nbsp;</p>
<p class="small">Sagot, B. (2010).&nbsp;The Le<em>fff</em>, a freely available and large-coverage morphological and syntantic lexicon for French.&nbsp;<em>Proceedings of LREC'10</em>.</p>
<p class="small">New, B., Pallier, C., Ferrand, L. &amp; Matos, R. (2001). A lexical database for contemporary french: LEXIQUE. <em>L'année Psychologique</em>.&nbsp;</p>
</div>
</div></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
SyntaxHighlighter.all();
</script>
</body>
</html>