pelican-nlp 0.3.8__py3-none-any.whl → 0.3.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pelican_nlp/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.3.8"
1
+ __version__ = "0.3.10"
@@ -0,0 +1,193 @@
1
+ # EPS conversions
2
+ # Apply conversion to all matching EPS files in directory
3
+ # Author: Piet Mertens
4
+ # Date: 2009-01-10
5
+ # Last modification: 2015-08-24
6
+
7
+ form Convert EPS file(s) to other file format (PDF, PNG, JPG, GIF) Apr 6, 2012
8
+ comment Enter the name (pattern) of input file(s)
9
+ text Input_files C:\corpus\*.eps
10
+ comment Output directory (including trailing slash)
11
+ text Output_directory <same_as_input>
12
+ optionmenu Output_format: 3
13
+ option GIF
14
+ option PDF
15
+ option JPG
16
+ option PNG
17
+ option multipage PDF of multiple EPS files
18
+ optionmenu Resolution: 4
19
+ option 72 (GIF, JPG, PNG, PDF)
20
+ option 96 (GIF, PNG)
21
+ option 120 (GIF, PNG)
22
+ option 300 (GIF, JPG, PNG, PDF)
23
+ option 600 (JPG, PDF)
24
+ endform
25
+
26
+ # This script assumes Ghostscript, nconvert and pdftk are installed.
27
+ # nconvert is required when converting to GIF format.
28
+ # pdftk is required when creating multipage PDF files.
29
+
30
+ # Ghostscript is available from http://www.cs.wisc.edu/~ghost/
31
+ # nconvert is available from http://www.xnview.com/
32
+ # pdftk is available from http://www.pdflabs.com/tools/pdttk-the-pdf-toolkit/
33
+
34
+ # Modify the following lines to match the path of these applications on your computer.
35
+
36
+ path_ghostscript$ = "C:\Program Files\gs\gs9.16\bin\gswin64c.exe"
37
+ path_nconvert$ = "C:\Program Files\XnView\nconvert"
38
+
39
+ # Don't change the following lines:
40
+
41
+ path_ghostscript$ = replace$ (path_ghostscript$, "\Program Files\", "\Progra~1\", 1)
42
+ path_nconvert$ = replace$ (path_nconvert$, "\Program Files\", "\Progra~1\", 1)
43
+
44
+ # ---------------------------------------------------------------
45
+
46
+ # commands for EPS to GIF
47
+ eps_png$ = path_ghostscript$ + " -dNOPAUSE -dBATCH -dQUIET -sDEVICE=png256 -sEPSCrop"
48
+ png_gif$ = path_nconvert$
49
+
50
+ # command fragments for EPS to PDF
51
+ eps_pdf$ = path_ghostscript$ + " -dNOPAUSE -dBATCH -dQUIET -sDEVICE=pdfwrite"
52
+
53
+ # command fragments for EPS to PDF
54
+ eps_jpg$ = path_ghostscript$ + " -dNOPAUSE -dBATCH -dQUIET -sDEVICE=jpeg -sEPSCrop"
55
+
56
+ if (rindex (input_files$,".") == 0)
57
+ call fatal_msg Invalid filename for input file: missing dot
58
+ endif
59
+
60
+ call fname_parts 'input_files$'
61
+ indir$ = result4$
62
+ basename$ = result2$
63
+ if (index (input_files$, "*") > 0)
64
+ use_filelist = 1
65
+ # Obtain list of files to process
66
+ Create Strings as file list... filelist 'input_files$'
67
+ nrofFiles = Get number of strings
68
+ if (nrofFiles < 1)
69
+ call fatal_msg No files matching input specification
70
+ endif
71
+ else
72
+ use_filelist = 0
73
+ nrofFiles = 1
74
+ if (not fileReadable (input_files$))
75
+ call fatal_msg Cannot open file
76
+ endif
77
+ endif
78
+ if (output_directory$ = "<same_as_input>")
79
+ outdir$ = indir$
80
+ else
81
+ call fname_parts output_directory$
82
+ outdir$ = result4$
83
+ endif
84
+ ;printline INDIR='indir$'
85
+ ;printline OUTDIR='outdir$'
86
+
87
+ pdf_out$ = replace_regex$ (input_files$, "[0-9\*]*\.eps", "\.pdf", 1)
88
+ pdf_in$ = replace_regex$ (input_files$, "\.eps", "\.pdf", 1)
89
+ pdf_files$ = ""
90
+ for iFile to nrofFiles
91
+ if (use_filelist)
92
+ select Strings filelist
93
+ fname$ = Get string... iFile
94
+ call fname_parts 'fname$'
95
+ basename$ = result2$
96
+ fname$ = basename$
97
+ else
98
+ fname$ = basename$
99
+ endif
100
+ pdf_files$ = pdf_files$ + "'basename$'.pdf "
101
+
102
+ src$ = indir$ + fname$
103
+ dst$ = outdir$ + fname$
104
+
105
+ res = extractNumber(resolution$, "")
106
+ # Call batch or system
107
+ if (output_format$ = "GIF")
108
+ command$ = "'eps_png$' -r'res' -sOutputFile=""'dst$'.png"" ""'src$'.eps"""
109
+ system 'command$'
110
+ command$ = "'png_gif$' -quiet -out gif 'dst$'.png"
111
+ system 'command$'
112
+ filedelete 'dst$'.png
113
+ elsif (output_format$ = "PNG")
114
+ system 'eps_png$' -r'res' -sOutputFile="'dst$'.png" "'src$'.eps"
115
+ elsif (index (output_format$, "PDF"))
116
+ if (res == 96 or res == 120)
117
+ printline Invalid resolution for PDF. Using 300 dpi.
118
+ res = 300
119
+ endif
120
+ system 'eps_pdf$' -r'res' -sOutputFile="'dst$'.pdf" "'src$'.eps"
121
+ elsif (output_format$ = "JPG")
122
+ if (res == 96 or res == 120)
123
+ printline Invalid resolution for JPEG. Using 300 dpi.
124
+ endif
125
+ command$ = "'eps_jpg$' -r'res' -sOutputFile=""'dst$'.jpg"" ""'src$'.eps"""
126
+ ;printline COMMAND='command$'
127
+ if (not fileReadable (path_ghostscript$))
128
+ call fatal_msg JPG output requires Ghostscript, which is not found at the path specified: ('path_ghostscript$')'newline$'Verify configuration for Ghostcript.
129
+ endif
130
+ system 'command$'
131
+ endif
132
+ endfor
133
+ if (index (output_format$, "multipage"))
134
+ ; use wildcard expansion by pdftk in order to avoid command line buffer overflow
135
+ command$ = "pdftk 'pdf_in$' cat output 'pdf_out$'"
136
+ system 'command$'
137
+ endif
138
+
139
+ if (use_filelist)
140
+ select Strings filelist
141
+ Remove
142
+ endif
143
+ exit
144
+
145
+
146
+ procedure fname_parts s_$
147
+ # Obtain filename parts
148
+ # s_$ the total filename
149
+ # result1$ the filename without path
150
+ # result2$ the basename (i.e. no path, no extension)
151
+ # result3$ the filename extension (excluding dot)
152
+ # result4$ the file path (including trailing slash) including drive
153
+ # result5$ the file path (including trailing slash) excluding drive
154
+ # result6$ the drive (excluding separator ':' )
155
+ result1$ = s_$
156
+ result2$ = ""
157
+ result3$ = ""
158
+ result4$ = ""
159
+ result5$ = ""
160
+ result6$ = ""
161
+ pos_ = rindex (s_$, "\")
162
+ if (pos_ = 0)
163
+ pos_ = rindex (s_$, "/")
164
+ endif
165
+ #printline fname parts s_$ 's_$' pos 'pos_'
166
+ if (pos_ > 0)
167
+ result4$ = mid$ (s_$, 1, pos_)
168
+ len_ = length (s_$) - pos_
169
+ result1$ = mid$ (s_$, pos_ + 1, len_)
170
+ endif
171
+ pos_ = rindex (result1$, ".")
172
+ if (pos_ > 0)
173
+ len_ = length (result1$)
174
+ result3$ = right$ (result1$, len_ - pos_)
175
+ result2$ = left$ (result1$, pos_ - 1)
176
+ else
177
+ result2$ = result1$
178
+ endif
179
+ pos_ = index (result4$, ":")
180
+ if (pos_ = 2)
181
+ len_ = length (result4$)
182
+ result5$ = right$ (result4$, len_ - pos_)
183
+ result6$ = left$ (result4$, pos_ - 1)
184
+ else
185
+ result5$ = result4$
186
+ endif
187
+ endproc
188
+
189
+
190
+ procedure fatal_msg text$
191
+ printline 'text$'
192
+ exit
193
+ endproc