TBX::Min - Read, write and edit TBX-Min files
version 0.07
use TBX::Min;
my $min = TBX::Min->new('/path/to/file.tbx');
my $entries = $min->entries;
my $termEntry = TBX::Min::TermEntry->new({id => 'B001'});
$min->add_entry($termEntry);
This module allows you to read, write and edit the contents of TBX-Min data.
use
ing this module also automatically use
s TBX::Min::TermEntry,
TBX::Min::LangSet, and TBX::Min::TIG via
Import::Into. LangSets contain TIGs(Term Information Groups), termEntries contain
LangSets, and this class contains termEntries. These correspond to the
three levels of information found in TML. You can build up TBX::Min
documents this way and then print them via "as_xml". You can also
read an entire TBX-Min XML document for editing via "new_from_xml".
TBX-Min is a minimal, DCT-style dialect of TBX. It's purpose is to represent extremely simple termbases, such as spreadsheets, and to be as human eye-friendly as possible. TBX-Min did not evolve from any other XML dialect, and so does not have historical artifacts such as "martif".
DCT stands for "Data Category as Tag Name". Whereas in most TBX
dialects categories such as partOfSpeech
are indicated through
attributes, in TBX-Min the tag names represent categories. This
makes for a very readable document. While TBX-Min documents do
conform to TML (Terminological Markup Language) structure, DCT
documents cannot be checked by the
TBX-Checker.
If you need more complex or information-rich termbases, we suggest you use TBX-Basic or even TBX-Default. If you have a TBX-Min document and would like to upgrade it to TBX-Basic, see Convert::TBX::Min. Alternatively if you would like to change your TBX-Basic to TBX-Min, see Convert::TBX::Basic.
Creates a new instance of TBX::Min. The single argument should be either a string pointer containing the TBX-Min XML data or the name of the file containing this data is required.
Creates a new TBX::Min
instance. Optionally you may pass in
a hash reference which is used to initialize the object. The allowed hash
fields are id
, description
, date_created
, creator
, license
,
directionality
, source_lang
and target_lang
, which correspond to
methods of the same name, and entries
, which should be an array reference
containing TBX::Min::TermEntry
objects. This method croaks if
date_created
is not in ISO 8601 format.
Get or set the document id. This should be a unique string identifying this glossary.
Get or set the document description.
Get or set the the date that the document was created. This should be a
string in ISO 8601 format. This method croaks if date_created
is not
in ISO 8601 format.
Get or set the name of the document creator.
Get or set the document license string.
Get or set the document directionality string. This string represents the direction of translation this document is designed for.
Get or set the code representing the document source language. This should
be ISO 639 and 3166 (e.g. en-US
, de
, etc.).
Get or set the code representing the document target language. This should
be ISO 639 and 3166 (e.g. en-US
, de
, etc.).
Returns an array ref containing the TBX::Min::TermEntry
objects contained
in the document.The array ref is the same one used to store the objects
internally, so additions or removals from the array will be reflected in future
calls to this method.
Adds the input TBX::Min::TermEntry
object to the list of language groups
contained by this object.
Returns a scalar reference containing an XML representation of this TBX-Min document. The data is a UTF-8 encoded string.
TBX::Min does not as of yet fully validate TBX-Min documents. It is possible to create non-validating XML via the as_xml method. This should be fixed in the future.
The following related modules:
- TBX::Min::TermEntry
- TBX::Min::LangSet
- TBX::Min::TIG
- TBX::Min::NoteGrp
- TBX::Min::Note
- Convert::TBX::Min
- Convert::TBX::Basic
Schema for valiating TBX-Min files are available on GitHub.
James Hayes <james.s.hayes@gmail.com>
This software is copyright (c) 2016 by Alan Melby.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.