Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Krista Liin
TÜveakorpus
Commits
d8ec70dc
Commit
d8ec70dc
authored
Apr 03, 2019
by
rabauti
Browse files
kataloogide loogika targemaks, lobiseb ka vähem
parent
78eae287
Changes
1
Hide whitespace changes
Inline
Side-by-side
korpus_sh/wrapSH.py
View file @
d8ec70dc
#/usr/bin/python
# -*- coding: utf-8 -*-
import
sys
import
os
import
getopt
import
re
import
subprocess
script_name
=
(
os
.
path
.
realpath
(
__file__
))
script_dir
=
os
.
path
.
dirname
(
script_name
)
#lähtefail
infile
=
'/Users/rabauti/repos/tu/ut_veakorpus/korpus_tsv/korpus.tsv'
sh_script
=
'/Users/rabauti/repos/tu/ut_veakorpus/korpus_sh/sh/sh.sh'
outfile
=
'/Users/rabauti/repos/tu/ut_veakorpus/korpus_sh/korpus.a'
###############################
...
...
@@ -57,7 +56,7 @@ def getOptions():
options
=
getOptions
()
if
not
"tsv_file"
in
options
or
not
len
(
options
[
'tsv_file'
]):
options
[
'tsv_file'
]
=
'..
/korpus_tsv/korpus.tsv'
options
[
'tsv_file'
]
=
re
.
sub
(
r
'[^\ /]*$'
,
''
,
script_dir
)
+
'
/korpus_tsv/korpus.tsv'
if
not
"result_file"
in
options
or
not
len
(
options
[
'result_file'
]):
...
...
@@ -85,7 +84,7 @@ for row in tsv_file.read().split('\n'):
arr
=
row
.
split
(
'
\t
'
)
if
len
(
arr
)
>
1
:
if
len
(
arr
[
0
])
and
len
(
arr
[
1
]):
print
([
options
[
'sh_script'
],
'%s'
%
arr
[
0
]
,
'%s'
%
arr
[
1
]]
)
#
print ([options['sh_script'], '%s'%arr[0] , '%s'%arr[1]] )
subprocess
.
run
([
options
[
'sh_script'
],
'%s'
%
arr
[
0
]
,
'%s'
%
arr
[
1
]],
stdout
=
outfile
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment