Skip to main content

Text label processing framework.

Project description

DataProcX

Text label processing framework.

Example

label.txt file:

SSB01120001 /data3/A07/spoof/SSB01120001.wav True
SSB01120002 /data3/A07/spoof/SSB01120002.wav True
SSB01120003 /data3/A07/spoof/SSB01120003.wav False
SSB01120004 /data3/A07/spoof/SSB01120004.wav True
SSB01120006 /data3/A07/spoof/SSB01120006.wav True
SSB01120007 /data3/A07/spoof/SSB01120007.wav False
SSB01120008 /data3/A07/spoof/SSB01120008.wav True
SSB01120009 /data3/A07/spoof/SSB01120009.wav False
SSB01120010 /data3/A07/spoof/SSB01120010.wav False
SSB01120011 /data3/A07/spoof/SSB01120011.wav True

main.py

import DataProc as dp

p = dp.Parser()

# function hook, preprocess every line txt, str -> str
p.preprocess = lambda x: x.strip() 

d = p.loadFile('label/label.txt', 0, ' ')
tmp = d.head(4)
print(tmp)
# [['SSB01120001' '/data3/A07/spoof/SSB01120001.wav' 'True'] 
#  ['SSB01120002' '/data3/A07/spoof/SSB01120002.wav' 'True'] 
#  ['SSB01120003' '/data3/A07/spoof/SSB01120003.wav' 'False']
#  ['SSB01120004' '/data3/A07/spoof/SSB01120004.wav' 'True']]

# function hook, postprocess be parsed every line list, list -> list
p.postprocess = lambda x: x[1:]
d = p.parse(tmp.head(3).col(1),0,'/')
print(d)
# [['data3' 'A07' 'spoof' 'SSB01120001.wav'] 
#  ['data3' 'A07' 'spoof' 'SSB01120002.wav'] 
#  ['data3' 'A07' 'spoof' 'SSB01120003.wav']]

# same
p.postprocess = lambda x: list(map(lambda y: y.strip('.wav')+'_proc', x[1:]))
d = p.parse(tmp.head(3).col(1),0,'/')
print(d)
# [['data3_proc' 'A07_proc' 'spoof_proc' 'SSB01120001_proc']
#  ['data3_proc' 'A07_proc' 'spoof_proc' 'SSB01120002_proc']
#  ['data3_proc' 'A07_proc' 'spoof_proc' 'SSB01120003_proc']]

# save to file
d.toCsv('label/label_proc.csv')

label_proc.csv (output file)

data3_proc,A07_proc,spoof_proc,SSB01120001_proc
data3_proc,A07_proc,spoof_proc,SSB01120002_proc
data3_proc,A07_proc,spoof_proc,SSB01120003_proc

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

DataProcX-0.1.3-py2.py3-none-any.whl (15.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file DataProcX-0.1.3-py2.py3-none-any.whl.

File metadata

  • Download URL: DataProcX-0.1.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.0

File hashes

Hashes for DataProcX-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c551ab18b83c3727e3461b284cb8d04128983784eb6c74214e4a7a9a7aadd703
MD5 bb6640212f1ee601e324b34519b0db92
BLAKE2b-256 a64b8ec85fdab7f46c4a2db525067ee2ccfb1656a9a4efb3e9ffe324532834f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page