Class XmlSessionReaderV1_2
java.lang.Object
ca.phon.session.io.xml.v1_2.XmlSessionReaderV1_2
- All Implemented Interfaces:
IPluginExtensionPoint<SessionReader>
,SessionReader
,XMLObjectReader<Session>
@XMLSerial(namespace="http://phon.ling.mun.ca/ns/phonbank",
elementName="session",
bindType=Session.class)
@SessionIO(group="ca.phon",
id="phonbank",
version="1.2",
mimetype="application/xml",
extension="xml",
name="Phon <3.6 (.xml)")
public class XmlSessionReaderV1_2
extends Object
implements SessionReader, XMLObjectReader<Session>, IPluginExtensionPoint<SessionReader>
Session XML reader for session files with
version 'PB1.2'
When reading in this older format alignment may be fixed.
Fixing alignment
Small pinchers for phonetic groups have been added to the IPA parser. This was necessary for one-to-one alignment and is our solution for upgrading Phon data. Currently, I don't do anything when reading the older version 1.3 files when alignment is not complete in groups. We previously discussed using ',' but I think now that is a mistake. Here are some siuations. In each example, I'm using upper case letters for words in orthography and smaller case for ipa.
Old Phon:
```
Orthography: [A] [B C] [D E F] [ ] [G H]
IPA Target: [1] [1 ] [1 2 3] [ ] [1 ]
IPA Actual: [a] [ ] [b c ] [d] [e f]
```
New Phon fixed alignment (spaces added for clarity):
```
Orthography: A ‹B C› ‹D E F› yyy G H .
IPA Actual: a * ‹b c› d e f
```
New Phon don't fix alignment:
```
Orthography: A B C D E F G H
IPA Actual: a b c d e f
```
Rules:
* If # of words match between Orthography and IPA - just add content (group 1/5 above)
* If there is content in Orthography and not IPA, wrap orthography in phonetic group markers if more than one word and add * to IPA tier (group 2 above)
* If there is content in IPA and not orthography, wrap IPA in phonetic group markers if more than one word and add yyy to Orthography (group 4 above)
* If there is content in both IPA and orthography but the number of words do not match, wrap Orthography and IPA in phonetic group markers if they have more than one word (group 3 above)
* If no terminator specified one will be added (e.g., '.')
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check to see if this reader can open the given file.Class
<?> Get type of extensionGet factory for extension point objectsboolean
Read from the given xml input stream.readSession
(InputStream stream) Create session from given input streamvoid
setFixAlignment
(boolean fixAlignment)
-
Constructor Details
-
XmlSessionReaderV1_2
public XmlSessionReaderV1_2()
-
-
Method Details
-
isFixAlignment
public boolean isFixAlignment() -
setFixAlignment
public void setFixAlignment(boolean fixAlignment) -
read
Description copied from interface:XMLObjectReader
Read from the given xml input stream.- Specified by:
read
in interfaceXMLObjectReader<Session>
- Returns:
- object of given type read from the given eventReader
- Throws:
IOException
- if something goes wrong
-
readSession
Description copied from interface:SessionReader
Create session from given input stream- Specified by:
readSession
in interfaceSessionReader
- Parameters:
stream
-- Returns:
- session
- Throws:
IOException
- if an error occurs
-
canRead
Description copied from interface:SessionReader
Check to see if this reader can open the given file.- Specified by:
canRead
in interfaceSessionReader
- Parameters:
file
-- Returns:
true
if this reader can open the given file,false
otherwise- Throws:
IOException
- if an error occurs when attempting to open a file
-
getExtensionType
Description copied from interface:IPluginExtensionPoint
Get type of extension- Specified by:
getExtensionType
in interfaceIPluginExtensionPoint<SessionReader>
-
getFactory
Description copied from interface:IPluginExtensionPoint
Get factory for extension point objects- Specified by:
getFactory
in interfaceIPluginExtensionPoint<SessionReader>
-