<commit_before><commit_msg>[utils] add tool for converting ntf to rpc<commit_after>#!/usr/bin/python
# tools for extracting RPC from NTIF/NTF file
# Copyright (C) 2016, <NAME> <<EMAIL>>

import sys, subprocess
if len(sys.argv)<2:
      print(" extracts RPC from NTIF/NTF file"%sys.argv[0])
      print("    usage: %s file.NTF > file.RPC"%sys.argv[0])
      exit()
x=subprocess.Popen(["gdalinfo", sys.argv[1]], stdout=subprocess.PIPE).communicate()[0]
x=x.splitlines()
#x=sys.stdin.readlines()
for l in x:
      if ('SAMP_' not in l) and ('LINE_' not in l) and ('HEIGHT_' not in l) and ('LAT_' not in l) and ('LONG_' not in l) and ('MAX_' not in l) and ('MIN_' not in l):
              continue
      y = l.strip().replace('=',': ')
      if 'COEFF' in y:
              z = y.split(' ')
              t=1
              for j in z[1:]:
                      print('%s_%d: %s'%(z[0][:-1],t,j))
                      t+=1
      else:
              print(y)

{'fraction_non_alphanumeric': 0.17523609653725078, 'fraction_numerical': 0.014690451206715634, 'mean_word_length': 2.301038062283737, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4866785', 'n_tokens_mistral': 362, 'n_tokens_neox': 350, 'n_words': 100}