- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中net.sf.okapi.common.XMLWriter.writeAttributeString()
方法的一些代码示例,展示了XMLWriter.writeAttributeString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLWriter.writeAttributeString()
方法的具体详情如下:
包路径:net.sf.okapi.common.XMLWriter
类名称:XMLWriter
方法名:writeAttributeString
[英]Writes an attribute and its associated value. You must use #writeStartElement(String) just before.
[中]写入属性及其关联值。您必须在之前使用#WriteStarteElement(字符串)。
代码示例来源:origin: net.sf.okapi/okapi-core
private void writeAnnotatorsRefIfNeeded () {
if ( needAnnotatorsRef && params.getIncludeIts() ) {
writer.writeAttributeString(Namespaces.ITS_NS_PREFIX+":annotatorsRef", annotatorsRef.peek());
needAnnotatorsRef = false;
}
}
代码示例来源:origin: net.sf.okapi/okapi-core
protected void writeAllPropertiesAsAttibutes (XMLWriter writer,
Set<String> names,
TextContainer item)
{
// Write any TUV-level properties as attributes (but only standard attributes)
for ( String name : names ) {
if (ATTR_NAMES.contains(";"+name+";") && !name.equals("tuid")) {
writer.writeAttributeString(name, item.getProperty(name).getValue());
}
}
}
代码示例来源:origin: net.sf.okapi/okapi-core
protected void writeAllPropertiesAsAttibutes (XMLWriter writer,
Set<String> names,
ITextUnit item)
{
// Write any TU-level properties as attributes (but only standard attributes)
for ( String name : names ) {
if ( ATTR_NAMES.contains(";"+name+";") && !name.equals("tuid")) {
writer.writeAttributeString(name, item.getProperty(name).getValue());
}
}
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-gttbatchtranslation
private void startExtractedBlock () {
try {
File tmpFile = File.createTempFile("~okapi-45_gttbt_", ".html");
blocks.add(tmpFile);
// Create the HTML file
htmlWriter = new XMLWriter(tmpFile.getPath());
// Start building the source file
htmlWriter.writeStartElement("html");
htmlWriter.writeStartElement("meta");
htmlWriter.writeAttributeString("http-equiv", "Content-Type");
htmlWriter.writeAttributeString("content", "text/html; charset=UTF-8");
htmlWriter.writeEndElementLineBreak();
count = 100; // Roughly
}
catch ( IOException e ) {
throw new OkapiIOException("Error creating extraction file.", e);
}
}
代码示例来源:origin: net.sf.okapi/okapi-core
protected void writeProp(String name, String value) {
// Write out the property
if (expandDuplicateProps) {
StringTokenizer st = new StringTokenizer(value, propValueSep, false);
while (st.hasMoreTokens()) {
writer.writeStartElement("prop");
writer.writeAttributeString("type", name);
writer.writeString(st.nextToken());
writer.writeEndElementLineBreak(); // prop
}
} else {
writer.writeStartElement("prop");
writer.writeAttributeString("type", name);
writer.writeString(value);
writer.writeEndElementLineBreak(); // prop
}
}
代码示例来源:origin: net.sf.okapi/okapi-core
private static void writeSizeProperties(XMLWriter writer, INameable resource) {
boolean sizeWritten = false;
if (resource.hasProperty(Property.MAX_WIDTH)) {
writer.writeAttributeString("maxwidth", resource.getProperty(Property.MAX_WIDTH).getValue());
sizeWritten = true;
}
if (resource.hasProperty(Property.MAX_HEIGHT)) {
writer.writeAttributeString("maxheight", resource.getProperty(Property.MAX_HEIGHT).getValue());
sizeWritten = true;
}
if (sizeWritten) {
if (resource.hasProperty(Property.SIZE_UNIT)) {
writer.writeAttributeString("size-unit", resource.getProperty(Property.SIZE_UNIT).getValue());
} else {
//default
writer.writeAttributeString("size-unit", "pixel");
}
}
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-leveraging
private XMLWriter startTemporaryFiles () {
// Create the HTML source file
XMLWriter htmlWriter = new XMLWriter(htmlSourceFile.getPath());
// Start building the source file
htmlWriter.writeStartElement("html");
htmlWriter.writeStartElement("meta");
htmlWriter.writeAttributeString("http-equiv", "Content-Type");
htmlWriter.writeAttributeString("content", "text/html; charset=UTF-8");
htmlWriter.writeEndElementLineBreak();
// Set the output name and make sure it's deleted
String path = htmlSourceFile.getAbsolutePath();
path = Util.getDirectoryName(path) + File.separator + Util.getFilename(path, false) + ".trg.html";
htmlTargetFile = new File(path);
if ( htmlTargetFile.exists() ) {
htmlTargetFile.delete();
}
// Create the store for the original source
path = htmlSourceFile.getAbsolutePath();
path = Util.getDirectoryName(path) + File.separator + Util.getFilename(path, false) + ".ori.bin";
originalStoreFile = new File(path);
store.create(originalStoreFile);
return htmlWriter;
}
代码示例来源:origin: net.sf.okapi/okapi-core
/**
* Writes the start of a <group> element.
* @see #writeEndGroup()
*/
public void writeStartGroup (StartGroup resource) {
if ( !inFile ) {
writeStartFile(original, dataType, skeletonPath, fwConfigId, fwInputEncoding, null);
}
String id = resource.getId();
String resName = resource.getName();
String resType = resource.getType();
writer.writeStartElement("group");
writer.writeAttributeString("id", id);
if ( !Util.isEmpty(resName) ) {
writer.writeAttributeString("resname", resName);
}
if ( !Util.isEmpty(resType) ) {
if ( resType.startsWith("x-") || ( RESTYPEVALUES.contains(";"+resType+";")) ) {
writer.writeAttributeString("restype", resType);
}
else { // Make sure the value is valid
writer.writeAttributeString("restype", "x-"+resType);
}
}
writeAnnotatorsRefIfNeeded();
writeSizeProperties(writer, resource);
writer.writeLineBreak();
}
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeAttributeString("version", "1.2");
writer.writeAttributeString("xmlns", Namespaces.NS_XLIFF12);
writer.writeAttributeString("xmlns:okp", Namespaces.NS_XLIFFOKAPI);
if ( params.getIncludeIts() ) {
writer.writeAttributeString("xmlns:"+Namespaces.ITS_NS_PREFIX, Namespaces.ITS_NS_URI);
writer.writeAttributeString("xmlns:"+Namespaces.ITSXLF_NS_PREFIX, Namespaces.ITSXLF_NS_URI);
writer.writeAttributeString(Namespaces.ITS_NS_PREFIX+":version", "2.0");
代码示例来源:origin: net.sf.okapi.lib/okapi-lib-segmentation
writer.writeAttributeString("xmlns", NSURI_SRX20);
if (saveExtensions) {
writer.writeAttributeString("xmlns:" + NSPREFIX_OKPSRX, NSURI_OKPSRX);
writer.writeAttributeString("version", "2.0");
version = "2.0";
writer.writeLineBreak();
writer.writeAttributeString("segmentsubflows", (segmentSubFlows ? "yes" : "no"));
writer.writeAttributeString("cascade", (cascade ? "yes" : "no"));
writer.writeLineBreak();
writer.writeAttributeString("type", "start");
writer.writeAttributeString("include", (includeStartCodes ? "yes" : "no"));
writer.writeAttributeString("type", "end");
writer.writeAttributeString("include", (includeEndCodes ? "yes" : "no"));
writer.writeAttributeString("type", "isolated");
writer.writeAttributeString("include", (includeIsolatedCodes ? "yes" : "no"));
writer.writeAttributeString("oneSegmentIncludesAll", (oneSegmentIncludesAll ? "yes" : "no"));
writer.writeAttributeString("trimLeadingWhitespaces", (trimLeadingWS ? "yes" : "no"));
writer.writeAttributeString("trimTrailingWhitespaces", (trimTrailingWS ? "yes" : "no"));
writer.writeAttributeString("useJavaRegex", "yes");
writer.writeAttributeString("useIcu4JBreakRules",
(useIcu4JBreakRules ? "yes" : "no"));
writer.writeAttributeString("treatIsolatedCodesAsWhitespace",
(treatIsolatedCodesAsWhitespace ? "yes" : "no"));
代码示例来源:origin: net.sf.okapi/okapi-core
private void writeXliffNotes(ITextUnit tu) {
XLIFFNoteAnnotation notes = tu.getAnnotation(XLIFFNoteAnnotation.class);
if (notes == null) {
return;
}
for (XLIFFNote n : notes) {
writer.writeStartElement("note");
// annotates
if (n.getAnnotates() != null) {
writer.writeAttributeString("annotates", n.getAnnotates().toString());
}
// from
if (n.getFrom() != null) {
writer.writeAttributeString("from", n.getFrom());
}
// priority
if (n.getPriority() != null) {
writer.writeAttributeString("priority", n.getPriority().toString());
}
writer.writeString(n.getNoteText());
writer.writeEndElementLineBreak(); // note
}
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-gttbatchtranslation
String out = String.format("%d:%s:%s", subDocId, tu.getId(), seg.id);
count += (out.length() + 10);
htmlWriter.writeAttributeString("id", out);
out = qutil.toCodedHTML(seg.text);
try {
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeStartElement("tu");
if ( !Util.isEmpty(tuid) ) {
writer.writeAttributeString("tuid", tuid);
writer.writeAttributeString("type", name);
writer.writeString(attributes.get(name));
writer.writeAttributeString("xml:lang", srcLoc.toBCP47());
writer.writeStartElement("seg");
writer.writeRawXML(tmxCont.setContent(source).toString());
writer.writeAttributeString("xml:lang",
((altTrgLoc != null) ? altTrgLoc.toBCP47() : trgLoc.toBCP47()));
writer.writeAttributeString(CREATIONID, attributes.get(CREATIONID));
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeAttributeString("original",
(original!=null) ? original : "unknown");
writer.writeAttributeString("source-language", srcLoc.toBCP47());
if ( trgLoc != null ) {
writer.writeAttributeString("target-language", trgLoc.toBCP47());
writer.writeAttributeString("datatype", dataType);
writer.writeAttributeString("okp:inputEncoding", inputEncoding);
writer.writeAttributeString("okp:configId", configId);
writer.writeStartElement("skl");
writer.writeStartElement("external-file");
writer.writeAttributeString("href", skeletonPath);
writer.writeAttributeString("tool-id", params.getToolId());
writer.writeAttributeString("tool-name", params.getToolName());
writer.writeAttributeString("tool-version", params.getToolVersion());
if (!Util.isEmpty(params.getToolCompany()))
writer.writeAttributeString("tool-company", params.getToolCompany());
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeStartElement("alt-trans");
if ( segment != null ) {
writer.writeAttributeString("mid", segment.getId());
writer.writeAttributeString("match-quality", String.format("%d", alt.getCombinedScore()));
writer.writeAttributeString("origin", alt.getOrigin());
writer.writeAttributeString("okp:"+OKP_MATCHTYPE, alt.getType().toString());
writer.writeAttributeString("okp:"+OKP_ENGINE, alt.getEngine());
writer.writeAttributeString("xml:lang", alt.getSourceLocale().toBCP47());
writer.writeAttributeString("xml:lang", alt.getTargetLocale().toBCP47());
if ( params.getIncludeIts() ) {
writeAnnotatorsRefIfNeeded();
代码示例来源:origin: net.sf.okapi.connectors/okapi-connector-microsoft
xmlWriter.writeElementString("From", srcLang);
xmlWriter.writeStartElement("Options");
xmlWriter.writeAttributeString("xmlns:o", "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2");
xmlWriter.writeElementString("o:Category", category);
xmlWriter.writeElementString("o:ContentType", contentType);
xmlWriter.writeAttributeString("xmlns:s", "http://schemas.microsoft.com/2003/10/Serialization/Arrays");
for (String text : texts) {
xmlWriter.writeStartElement("s:string");
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeAttributeString("tuid", tuid);
writer.writeAttributeString("tuid", String.format("%s_%s", tuid, srcSeg.id));
代码示例来源:origin: net.sf.okapi/okapi-core
writer.writeAttributeString("xml:lang", locale.toBCP47());
if (isWriteAllPropertiesAsAttributes()) {
Set<String> names;
writer.writeAttributeString("type", name);
writer.writeString(contForProp.getProperty(name).getValue());
代码示例来源:origin: net.sf.okapi.connectors/okapi-connector-microsoft
public String toXML() {
StringWriter sw = new StringWriter();
XMLWriter xml = new XMLWriter(sw);
xml.writeStartDocument();
xml.writeStartElement("TranslateOptions");
xml.writeAttributeString("xmlns", "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2");
xml.writeStartElement("Category");
xml.writeString(this.category);
xml.writeEndElement();
xml.writeStartElement("ContentType");
xml.writeString(this.contentType);
xml.writeEndElement();
xml.writeStartElement("ReservedFlags");
xml.writeEndElement();
xml.writeStartElement("State");
xml.writeEndElement();
xml.writeStartElement("Uri");
xml.writeEndElement();
xml.writeStartElement("User");
xml.writeString("defaultUser");
xml.writeEndElement();
xml.writeEndElement(); // !TranslateOptions
xml.close();
return sw.toString();
}
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit
XR.writeStartElement("omegat");
XR.writeStartElement("project");
XR.writeAttributeString("version", "1.0");
我正在尝试用 python 实现 Okapi BM25。虽然我看过一些教程如何做到这一点,但我似乎陷入了这个过程。 所以我收集了文档(并且具有“id”和“text”列)和查询(并且具有“id”和“te
本文整理了Java中net.sf.okapi.common.XMLWriter类的一些代码示例,展示了XMLWriter类的具体用法。这些代码示例主要来源于Github/Stackoverflow/M
我正在研究 Okapi BMS25 模型。我明白一切,但两个困惑。同时计算文档长度(dl)和平均文档长度(avdl)。我发现文档长度是 所以它是我在特定文档中的关键字/术语的总和。但是当我看到维基的定
我正在使用 elasticsearch 进行研究。我原计划使用余弦相似度,但我注意到它不可用,而是我们将 BM25 作为默认评分函数。 这有什么原因吗?余弦相似度是否不适用于查询文档?为什么默认选择
我发现 Okapi 相似度度量可用于计算文档相似度 http://www2002.org/CDROM/refereed/643/node6.html以及本文 http://singhal.info/i
本文整理了Java中net.sf.okapi.common.skeleton.ZipSkeleton类的一些代码示例,展示了ZipSkeleton类的具体用法。这些代码示例主要来源于Github/St
本文整理了Java中net.sf.okapi.common.XMLWriter.writeElementString()方法的一些代码示例,展示了XMLWriter.writeElementStrin
本文整理了Java中net.sf.okapi.common.XMLWriter.writeComment()方法的一些代码示例,展示了XMLWriter.writeComment()的具体用法。这些代
本文整理了Java中net.sf.okapi.common.XMLWriter.writeLineBreak()方法的一些代码示例,展示了XMLWriter.writeLineBreak()的具体用法
本文整理了Java中net.sf.okapi.common.XMLWriter.close()方法的一些代码示例,展示了XMLWriter.close()的具体用法。这些代码示例主要来源于Github
本文整理了Java中net.sf.okapi.common.XMLWriter.writeRawXML()方法的一些代码示例,展示了XMLWriter.writeRawXML()的具体用法。这些代码示
本文整理了Java中net.sf.okapi.common.XMLWriter.writeEndElementLineBreak()方法的一些代码示例,展示了XMLWriter.writeEndEle
本文整理了Java中net.sf.okapi.common.XMLWriter.writeEndElement()方法的一些代码示例,展示了XMLWriter.writeEndElement()的具体
本文整理了Java中net.sf.okapi.common.XMLWriter.writeStartElement()方法的一些代码示例,展示了XMLWriter.writeStartElement(
本文整理了Java中net.sf.okapi.common.XMLWriter.writeEndDocument()方法的一些代码示例,展示了XMLWriter.writeEndDocument()的
本文整理了Java中net.sf.okapi.common.XMLWriter.writeStartDocument()方法的一些代码示例,展示了XMLWriter.writeStartDocumen
本文整理了Java中net.sf.okapi.common.XMLWriter.writeAttributeString()方法的一些代码示例,展示了XMLWriter.writeAttributeS
本文整理了Java中net.sf.okapi.common.XMLWriter.()方法的一些代码示例,展示了XMLWriter.()的具体用法。这些代码示例主要来源于Github/Stackover
本文整理了Java中net.sf.okapi.common.XMLWriter.writeString()方法的一些代码示例,展示了XMLWriter.writeString()的具体用法。这些代码示
我想知道如何使用 Okapi 框架/Rainbow 实现以下目标: 将 Java I18N 属性文件转换为 XLIFF 进行翻译,其中某些翻译已存在并且应成为 XLIFF 文件的一部分。 我有两个 J
我是一名优秀的程序员,十分优秀!