File: pattern-shell.html

package info (click to toggle)
python-pattern 2.6%2Bgit20150109-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,672 kB
  • sloc: python: 53,865; xml: 11,965; ansic: 2,318; makefile: 94
file content (115 lines) | stat: -rw-r--r-- 5,586 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
    <title>pattern-shell</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-shell" class="noexternal" target="_blank">http://www.clips.ua.ac.be/pages/pattern-shell</a></div>
        <h1>pattern.shell</h1>
        <!-- Parsed from the online documentation. -->
        <div id="node-1400" class="node node-type-page"><div class="node-inner">
<div class="content">
<h2>pattern.en parser</h2>
<p>The English parser can be invoked from the command-line.&nbsp;The&nbsp;<a href="pattern.html">pattern</a> module should be installed (i.e., located in <span class="inline_code">/site-packages</span>, see installation instructions) or the current working directory should be the one that contains the <span class="inline_code">pattern</span> folder.</p>
<pre class="brush:python; gutter:false; light:true;">&gt; python -m pattern.en -f file.txt</pre><p><span>If no options are given a full parse is executed (i.e. tokenization, tagging, chunking, relations and lemmata). Otherwise, you need to explicitly list every required option:</span></p>
<table class="border">
<tbody>
<tr>
<td><span class="inline_code">-O</span></td>
<td><span class="inline_code">--tokenize</span></td>
<td>Tokenize the input.</td>
</tr>
<tr>
<td><span class="inline_code">-T&nbsp;</span></td>
<td><span class="inline_code">--tags&nbsp;</span></td>
<td>Parse part-of-speech tags.</td>
</tr>
<tr>
<td><span class="inline_code">-C</span>&nbsp;</td>
<td><span class="inline_code">--chunks&nbsp;</span></td>
<td>Parse chunks and <span class="postag">PNP</span> tags.&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-R</span>&nbsp;</td>
<td><span class="inline_code">--relations</span>&nbsp;</td>
<td>Parse verb/predicate relations.&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-L</span>&nbsp;</td>
<td><span class="inline_code">--lemmata&nbsp;</span></td>
<td>Parse lemmata (<em>was</em> → <em>be</em>).&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-f&nbsp;</span></td>
<td><span class="inline_code">--file</span>&nbsp;</td>
<td>Input file path.&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-s&nbsp;</span></td>
<td><span class="inline_code">--string&nbsp;</span></td>
<td>Input string.&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-e</span>&nbsp;</td>
<td><span class="inline_code">--encoding</span>&nbsp;</td>
<td>Specify character encoding (utf-8 by default).&nbsp;</td>
</tr>
<tr>
<td><span class="inline_code">-v&nbsp;</span></td>
<td class="inline_code">--version</td>
<td>Print current version of Pattern.</td>
</tr>
</tbody>
</table>
<p>Short options can be concatenated. Also note the <span class="inline_code">xml</span> option which produces XML output:</p>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.en xml -OT -s 'The black cat sat on the mat.'</pre></div>
<h3><span>pattern.es | de | fr | it | nl parsers</span></h3>
<p><span>The parsers for other languages work in the same way. Note the <span class="inline_code">xml</span> option (produces XML output).</span></p>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.es -s 'El gato negro se sienta en la estera.'</pre></div>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.de -s 'Die schwarze Katze liegt auf der Matte.'</pre></div>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.fr -s "Le chat noir s'était assis sur le tapis."</pre></div>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.it -s 'Il gatto nero faceva le fusa.'</pre></div>
<div class="example">
<pre class="brush: python;gutter: false; light: true; fontsize: 100; first-line: 1; ">&gt; python -m pattern.nl -s 'De zwarte kat zat op de mat.'</pre></div>
</div>
</div></div>
        </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    <script>
        SyntaxHighlighter.all();
    </script>
</body>
</html>