Package: xml-miner
XML/TRXML SelectorDescriptionThis package provides two scripts:mine-xmlandmine-trxml.mine-xmlselects tags from xml/mxml files, and save the
selected values to file.mine-trxmlselects fields from trxml/mtrxml files, and save
the selected values to file.StatusRequirementsPython 3.6+Installationpip install xml-selectorUsageUse xml selector scriptThe xml selector supports:one or more tagnames:selector could be one tagnamenameor comma separated tagnameslangskill,compskill,softskillsmultiple sources:e.g. select from xml dir, xml files, mxml file, or directly from
annotation serverexamples:#select from xml directory
mine-xml --source tests/xmls/ --selector name --output_file name.tsv
mine-xml --source tests/xmls/ --selector langskill,compskill,softskill --output_file skill.tsv --with_field_name

#select from xml file or mxml file
mine-xml --source tests/sample.mxml --selector experience --output_file experience.tsv

#select directly from annotation server
mine-xml --source localhost:50249 --selector name --output_file name.tsv --query "set Data2018"Use trxml selector scriptThe trxml selector supports:one or more selectors:selector can be one field:name.0.nameor comma separated fields:name.0.name,address.0.addresssingle or multi item:can select field from one item, e.g.experienceitem.3.experienceor select field value of all item, e.g.experienceitem.experience(orexperienceitem.*.experience)multiple sources:e.g. select from trxml dir, trxml files, or mtrxml fileexamples:# one selector, single item
mine-trxml --source tests/trxmls/ --selector name.0.name --output_file name.tsv

# one selector, multiple item
mine-trxml --source tests/sample.mxml --selector experienceitem.experience --output_file experience.tsv

# more selectors, single item
mine-trxml --source tests/trxmls/ --selector name.0.name,address.0.address,phone.0.phone --output_file personal.tsv

# more selectors, multiple item
mine-trxml --source tests/sample.mxml  --itemgroup experienceitem --fields experience,experiencedate --output_file experience.tsv
mine-trxml --source tests/sample.mxml  --selector experienceitem.*.experience,experienceitem.*.experiencedate --output_file experience.tsv
mine-trxml --source tests/sample.mxml  --selector experienceitem.experience,experienceitem.experiencedate --output_file experience.tsvDevelopmentTo install package and its dependencies, run the following from project
root directory:python setup.py installTo work the code and develop the package, run the following from project
root directory:python setup.py developTo run unit tests, execute the following from the project root
directory:python setup.py testselector and output details:mine-xml:input: documents, selector(s), outputoutput:default (parameterwith_field_namenot set):filename, field_valuee.g. select all names with selectornamefilenamevaluexxxxChao Liparameterwith_field_nameset:filename, field_value, field_namee.g. select skills with selectorcompskill,langskill,otherskillfilenamevaluefieldxxxxjavacompskillxxxxdutchlangskillmine-trxmlinput:documents, selector(s), output,documents, itemgroup, fields, outputsingle selector:single item (name.0.name): filename fieldfilenamename.0.namexxxxChao Limulti items (skill.*.skill): filename item_index fieldfilenameitem_indexfieldxxxx0javaxxxx1dutchmultiple selectorssingle item: filename, field1, field2 …each selector points to a field of a specific item with a digital
index, e.g.name.0.lastname,name.0.firstname,address.0.countryfilenamename.0.lastnamename.0.firstnameaddress.0.countryxxxxLiChaoChinaxxxxLeeRichardUSAmulti items: filename, item_index, field1, field2 …each selector points to a field from all items in an itemgroup, e.g.skill.skill,skill.type,skill.datefilenameskillskilltypedatexxxx0javacompskill2001-2005xxxx1dutchlangskill2002-0.0.5 (2019-10-14)bug fix: ElementTree xpath find will return a None if value is an empty string, restore to empty string0.0.4 (2019-09-11)bug fix: reading always use utf8, and not continue reading if failed on encoding of one document0.0.3 (2019-08-11)expand miner.py module to generate matched phrases per doc0.0.2 (2019-08-09)added support for CI0.0.1 (2019-08-09)make two script: mine-xml and mine-trxml0.0.0 (2019-08-06)Add the first version of the mine_xml and mine_trxml