Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion for extracting CNRTL Est Républicain Corpus #99

Open
tattorba87 opened this issue Feb 28, 2020 · 1 comment
Open

Suggestion for extracting CNRTL Est Républicain Corpus #99

tattorba87 opened this issue Feb 28, 2020 · 1 comment

Comments

@tattorba87
Copy link

Instead of using:

xmllint --xpath '//[local-name()="div"][@type="article"]//[local-name()="p" or local-name()="head"]/text()' Annee*/*.xml | perl -pe 's/^ +//g ; s/^ (.+)/$1\n/g ; chomp' > est_republicain.txt

this seems to work better:

xmlstarlet sel -t -v '//[local-name()="div"][@type="article"]//[local-name()="p" or local-name()="head"]/text()' Annee*/*.xml | perl -pe 's/^ +//g ; s/^ (.+)/$1\n/g ; chomp' > est_republicain.txt

As xmllint was replacing several French characters with their hex format. xmlstarlet doesn't seem to have this issue

@tattorba87
Copy link
Author

Or even better:

xmlstarlet sel -t -m '//[local-name()="div"][@type="article"]//[local-name()="p" or local-name()="head"]/text()' -n --var linebreak -n --break -v "translate(., $linebreak, '')" Annee*/*.xml | perl -pe 's/^ +//g ; s/^ (.+)/$1\n/g; s/ +/ /g' > est_republicain.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant