コード例 #1
0
ファイル: gutenberg.py プロジェクト: miku/gluish
 def run(self):
     output = shellout('marctotsv -k -s "|" {input} 001 653.a > {output}',
              input=self.input().get('dump').path)
     with luigi.LocalTarget(output, format=TSV).open() as handle:
         with self.output().open('w') as output:
             for row in handle.iter_tsv(cols=('id', 'terms')):
                 for subfield in row.terms.split('|'):
                     for term in subfield.split('--'):
                         term = term.strip()
                         output.write_tsv(row.id, term)
コード例 #2
0
 def run(self):
     output = shellout('marctotsv -k -s "|" {input} 001 653.a > {output}',
                       input=self.input().get('dump').path)
     with luigi.LocalTarget(output, format=TSV).open() as handle:
         with self.output().open('w') as output:
             for row in handle.iter_tsv(cols=('id', 'terms')):
                 for subfield in row.terms.split('|'):
                     for term in subfield.split('--'):
                         term = term.strip()
                         output.write_tsv(row.id, term)
コード例 #3
0
ファイル: gutenberg.py プロジェクト: miku/gluish
 def run(self):
     url = "http://gutenberg.readingroo.ms/cache/generated/feeds/catalog.marc.bz2"
     output = shellout('wget -q "{url}" -O {output}', url=url)
     output = shellout('bunzip2 {input} -c > {output}', input=output)
     luigi.LocalTarget(output).move(self.output().path)
コード例 #4
0
ファイル: gutenberg.py プロジェクト: miku/gluish
 def run(self):
     output = shellout("cut -f 2- {input}| sort | uniq -c | sort -nr > {output}",
                       input=self.input().path)
     luigi.LocalTarget(output).move(self.output().path)
コード例 #5
0
ファイル: newspapers.py プロジェクト: titabo2k/gluish
 def run(self):
     """ Just run wget quietly. """
     output = shellout('wget -q "{url}" -O {output}', url=self.url)
     luigi.LocalTarget(output).move(self.output().path)
コード例 #6
0
 def run(self):
     url = "http://gutenberg.readingroo.ms/cache/generated/feeds/catalog.marc.bz2"
     output = shellout('wget -q "{url}" -O {output}', url=url)
     output = shellout('bunzip2 {input} -c > {output}', input=output)
     luigi.LocalTarget(output).move(self.output().path)
コード例 #7
0
 def run(self):
     output = shellout(
         "cut -f 2- {input}| sort | uniq -c | sort -nr > {output}",
         input=self.input().path)
     luigi.LocalTarget(output).move(self.output().path)
コード例 #8
0
ファイル: newspapers.py プロジェクト: miku/gluish
 def run(self):
     """ Just run wget quietly. """
     output = shellout('wget -q "{url}" -O {output}', url=self.url)
     luigi.LocalTarget(output).move(self.output().path)