-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 47fa305
Showing
11 changed files
with
980 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include MANIFEST.in | ||
include README.txt | ||
include README-win.txt | ||
include setup.cfg | ||
include stdeb.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Formatgloss | ||
=========== | ||
|
||
|
||
## Description ## | ||
|
||
The linguistic software Toolbox can produce interlinearised glosses of data | ||
acquired during fieldwork. However glosses containing combining diacritics are | ||
often misaligned. | ||
|
||
The present script scans text files for Toolbox glosses and realigns them | ||
taking diacritics into consideration. It comes with a command-line interface | ||
as well as a graphical user interface written in wxPython. | ||
|
||
|
||
## Usage ## | ||
|
||
Command-line interface: | ||
|
||
formatgloss_cli.exe file | ||
|
||
Graphical user interface: | ||
|
||
formatgloss.exe | ||
|
||
|
||
## License ## | ||
|
||
Copyright (c) 2013 Johannes Englisch | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Formatgloss | ||
=========== | ||
|
||
|
||
## Description ## | ||
|
||
The linguistic software Toolbox can produce interlinearised glosses of data | ||
acquired during fieldwork. However glosses containing combining diacritics are | ||
often misaligned. | ||
|
||
The present script scans text files for Toolbox glosses and realigns them | ||
taking diacritics into consideration. It comes with a command-line interface | ||
as well as a graphical user interface written in wxPython. | ||
|
||
|
||
## Requirements ## | ||
|
||
* This script requires at least Python 2.6 | ||
* The graphical user interface requires wxPython | ||
|
||
|
||
## Usage ## | ||
|
||
Command-line interface: | ||
|
||
formatgloss_cli.py file | ||
|
||
Graphical user interface: | ||
|
||
formatgloss.pyw | ||
|
||
|
||
## License ## | ||
|
||
Copyright (c) 2013 Johannes Englisch | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#! /usr/bin/env python | ||
|
||
'''Graphical user interface to formatgloss. | ||
This script opens a Toolbox file and reformats glosses in it. Opening the | ||
input file and saving the reformatted file are accompanied by a wxPython | ||
user interface. | ||
''' | ||
|
||
|
||
import wx | ||
import formatglosslib.gui | ||
|
||
|
||
def main(): | ||
'''Run wx and create the main frame''' | ||
wxapp = wx.App() | ||
formatglosslib.gui.ResultsWindow(parent=None) | ||
wxapp.MainLoop() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#! /usr/bin/env python | ||
|
||
'''Command-line interface to Formatgloss. | ||
This script reads a Toolbox file and reformats glosses in it. The | ||
reformatted glosses are then printed out to standard output. | ||
''' | ||
|
||
|
||
import sys | ||
import formatglosslib.tbgloss as tbgloss | ||
|
||
|
||
def format_faulty_gloss(gloss): | ||
'''Format a faulty gloss for printing. | ||
:param gloss: gloss to be formatted | ||
:type gloss: tbgloss.ToolboxGloss | ||
:return: formatted gloss | ||
:rtype: str | ||
''' | ||
head = '\n{0:=^60}'.format(' WARNING ') | ||
error = '({0})'.format(gloss.error) | ||
msg = 'Could not parse following gloss:' | ||
line = 60 * '-' | ||
foot = 60 * '=' | ||
return '\n'.join([head, msg, error, line, str(gloss), foot]) | ||
|
||
|
||
def main(args): | ||
'''Read toolbox file and print reformatted file to stdout. | ||
:param args: command-line arguments | ||
:type args: list of str | ||
''' | ||
if len(args) != 2: | ||
sys.stderr.write('Error: needs exactly one text file.\n') | ||
return | ||
with open(args[1]) as input_file: | ||
lines = input_file.readlines() | ||
lines = [line.decode(tbgloss.INPUT_ENC).rstrip() for line in lines] | ||
toolbox_file = tbgloss.ToolboxFile(lines) | ||
print str(toolbox_file) | ||
for gloss in toolbox_file.get_glosses(): | ||
if gloss.is_faulty: | ||
sys.stderr.write(format_faulty_gloss(gloss) + '\n') | ||
|
||
|
||
if __name__ == '__main__': | ||
main(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
'''This package provides the modules for Formatgloss.''' |
Oops, something went wrong.