gpt4 book ai didi

pl.edu.icm.model.bwmeta.y.YDescription.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 13:54:40 26 4
gpt4 key购买 nike

本文整理了Java中pl.edu.icm.model.bwmeta.y.YDescription.<init>()方法的一些代码示例,展示了YDescription.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YDescription.<init>()方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YDescription
类名称:YDescription
方法名:<init>

YDescription.<init>介绍

暂无

代码示例

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import

/**
 * Creates a description given its language, text and type.
 * If the text is empty or null, does not create a description but returns null.
 * 
 * @param lang language of the description
 * @param text text of the description, may be null
 * @param type type of the description
 * @return created description, or null if text was empty or null
 */
public YDescription description(YLanguage lang, YRichText text, String type) {
  if (empty(text)) return null;
  return new YDescription(lang, text, type);
}

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import

/**
 * Creates a description given its language, text and type.
 * If the text is empty or null, does not create a description but returns null.
 * 
 * @param lang language of the description
 * @param text text of the description, may be null
 * @param type type of the description
 * @return created description, or null if text was empty or null
 */
public YDescription description(YLanguage lang, String text, String type) {
  if (empty(text)) return null;
  return new YDescription(lang, text, type);
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

private static void replaceDescriptionsField(final YElement yElement, final String[] values) {
  if (values != null && values.length > 0) {
    final List<YDescription> descriptions = yElement.getDescriptions();
    // remove abstracts
    final List<YDescription> removed = clear(descriptions, YConstants.DS_ABSTRACT);
    if (removed.size() != values.length) {
      log.warn("Different count of field:{} values from search-{} and bwmeta-{}. Some values may be lost.",
          new Object[] { IndexFields.F_DESCRIPTIONS, values.length, removed.size() });
    }
    // add highlighted values
    for (final String value : values) {
      final String[] langValue = StringUtils.split(value, " ", 2);
      final YLanguage lang = determineLang(langValue);
      if (lang != null) {
        descriptions.add(new YDescription(lang, langValue[1], YConstants.DS_ABSTRACT));
      }
    }
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl

@Override
protected boolean enhanceMetadata(BxDocument document, YElement metadata) {
  String text = "";
  for (BxPage page : filterPages(document)) {
    for (BxZone zone : filterZones(page)) {
      String[] lines = zone.toText().split("\n");
      for (String line : lines) {
        if (line.toLowerCase().startsWith("keywords")
          || line.toLowerCase().startsWith("key words")) {
          break;
        }
        text += "\n" + line;
      }
    }
   }
  text = text.trim();
  if (!text.isEmpty()) {
    Matcher matcher = PREFIX.matcher(text);
    if (matcher.find()) {
      text = text.substring(matcher.end()).trim();
    }
    metadata.addDescription(new YDescription().setType(YConstants.DS_ABSTRACT).setText(text));
    return true;
  }
  return false;
}

代码示例来源:origin: pl.edu.icm.synat/synat-sdk-sample-services

private List<String> trySoncaKeywords(YElement element, String finalText) {
  try {
    YDescription description = new YDescription(YLanguage.Polish, finalText);
    element.addDescription(description);
    YElement enrich = soncaMetadataEnricher.enrich(Lists.newArrayList(element));
    List<YTagList> tagLists = enrich.getTagLists("sonca.keywords");
    YTagList polishTagList = null;
    for (YTagList yTagList : tagLists) {
      if (yTagList.getLanguage() == YLanguage.Polish) {
        polishTagList = yTagList;
      }
    }
    if (polishTagList != null) {
      return polishTagList.getValues();
    } else {
      return new ArrayList<String>();
    }
  } catch (Exception e) {
    e.printStackTrace();
    return new ArrayList<String>();
  }
}

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

public void updateElementContentLinks(org.jdom.Element ameta, YElement article) {
  List<org.jdom.Element> selfs = JDOMHelper.getChildren(ameta, "self-uri");
  for (org.jdom.Element uri : selfs) {
    String type = FileTypes.FT_FULL_TEXT;
    String mime = uri.getAttributeValue("content-type");
    if (mime == null) {
      type = FileTypes.FT_ELEMENT_WEBPAGE;
      mime = "text/html";
    }
    String href = uri.getAttributeValue("href", XLINK_NAMESPACE);
    YContentFile contentFile = y.contentFile(href, type, mime, href);
    if (contentFile!=null) {
     contentFile.addDescription(new YDescription(YLanguage.English, uri.getValue()));
     article.addContent(contentFile);
    }
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl

public void convertDescription(BibEntry source, YElement yElement) {
  //note
  String note = source.getFirstFieldValue(BibEntry.FIELD_NOTE);
  if (note != null) {
    yElement.addDescription(new YDescription().setType(YConstants.DS_NOTE).setText(note));
  }
  //abstract
  String abstractField = source.getFirstFieldValue(BibEntry.FIELD_ABSTRACT);
  if (abstractField != null) {
    yElement.addDescription(new YDescription().setType(YConstants.DS_ABSTRACT).setText(abstractField));
  }
}

代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core

private YDescription toYAbstract(LocalizedString abstractValue) {
  YLanguage language = YLanguage.byCode(abstractValue.getLang(), YLanguage.English);
  YRichText yAbstractText = yRichTextExtractor.extractFrom(abstractValue.getText());
  YDescription description = new YDescription(language, yAbstractText, YConstants.DS_ABSTRACT);
  return description;
}

代码示例来源:origin: pl.edu.icm.synat/synat-importer-yadda

private YElement prepareYElement(String id, Properties prop) {
  YElement yElement = new YElement();
  yElement.setId(id);
  if (!prop.getProperty("title").isEmpty()) {
    yElement.addName(new YName(prepareProperty("title", prop)));
  }
  
  yElement.addDescription(new YDescription(YLanguage.Undetermined, prepareProperty("description", prop), DescriptionTypes.DS_SUMMARY));
  
  if (!prop.getProperty("key-words").isEmpty()) {
    List<String> tags = new ArrayList<String>(Arrays.asList(prepareProperty("key-words", prop).split(",")));
    yElement.addTagList(new YTagList().setType(TagTypes.TG_KEYWORD).setValues(tags));
  }
  
  if (!prop.getProperty("supplier").isEmpty()) {
    yElement.addAttribute("copyright-holder", prepareProperty("supplier", prop));
  }
  
  if (!prop.getProperty("duration").isEmpty()) {
    yElement.addAttribute("duration", prepareProperty("duration", prop));
  }
  yElement.addLanguage(YLanguage.Undetermined);
  
  return yElement;
}

代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct

private YDescription createDescription(String descriptionType, YLanguage yLanguage, Abstract abs) {
  String abstractContent = abs.getAbstractContent();
  YRichText richText = BaseYModelUtils.buildRichText(abstractContent);
  YDescription desc = new YDescription();
  desc.setLanguage(yLanguage);
  desc.setType(descriptionType);
  desc.setText(richText);
  return desc;
}

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import

private void updateArticleDescription(ZentralBlattRecord src, YElement yelement) {
  if (src.hasField("ab")) {
    String abText = src.getField("ab").trim();
    if (isValidDescription(abText)) {
      YDescription desc = new YDescription();
      desc.setType(isSummary(abText) ? YConstants.DS_SUMMARY : YConstants.DS_ABSTRACT);
      desc.setText(filterAbstractPrefixes(abText));
      yelement.addDescription(desc);
    }
  }
}

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

protected YDescription convert(Abstract abs) {
  YDescription description = new YDescription();
  if (StringUtils.isNotBlank(abs.getLang())) {
    description.setLanguage(YLanguage.byCode(abs.getLang()));
  }
  final List<Part> parts;
  if (!abs.getPS().isEmpty()) {
    parts = convertToParts(abs.getPS());
  } else if (!abs.getSecs().isEmpty()) {
    parts = convertToParts(abs.getSecs());
  } else {
    return null;
  }
  YRichText richText = new YRichText(parts);
  description.setText(richText);
  return description;
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

protected void updateYElement(final DataSet dataSet, final YElement yElement) {
  YStructure yStructure = new YStructure(DATA_SET_YSTRUCTURE);
  YCurrent yCurrent = new YCurrent(DATA_SET_YLEVEL);
  yStructure.setCurrent(yCurrent);
  Collection<YStructure> structures = Collections.singletonList(yStructure);
  yElement.setStructures(structures);
  
  if (StringUtils.isNotBlank(dataSet.getId())) {
    yElement.setId(DATA_SET_YELEMENT_ID_PREFIX + dataSet.getId());
  }
  
  if (StringUtils.isNotBlank(dataSet.getName())) {
    yElement.setNames(Collections.singletonList(new YName(dataSet.getName())));
  }
  
  if (StringUtils.isNotBlank(dataSet.getDescription())) {
    yElement.setDescriptions(Collections.singletonList(new YDescription(YLanguage.Undetermined, dataSet.getDescription())));
  }
  if (dataSet.getDefaultLicense() != null) {
    YTagList tagList = new YTagList();
    tagList.setType(YModelUtils.LICENSE);
    tagList.addValue(dataSet.getDefaultLicense().getId());
    yElement.addTagList(tagList);
  }
}

代码示例来源:origin: pl.edu.icm.synat/synat-process-common

private boolean addMetadataIfNeeded(HarvestingResult harvestingResult, YElement element) {
  boolean metadataModified = false;
  if (shouldAbstractBeAdded(harvestingResult, element)) {
    Node htmlNode = new Node(BaseYModelUtils.XHTML_NAMESPACE, BaseYModelUtils.HTML_TAG);
    htmlNode.addPart(new Leaf(StringUtils.trim(harvestingResult.getDesciption())));
    YRichText richText = new YRichText(Arrays.asList(htmlNode));
    YDescription newAbstract = new YDescription(YLanguage.Undetermined, richText, DescriptionTypes.DS_ABSTRACT);
    element.addDescription(newAbstract);
    metadataModified = true;
  }
  if (shouldImpactFactorBeAdded(harvestingResult, element)) {
    element.addAttribute(new YAttribute(YModelUtils.IMPACT_FACTOR, harvestingResult.getImpactFactor().toEngineeringString()));
    metadataModified = true;
  }
  if (shouldFrequencyBeAdded(harvestingResult, element)) {
    element.addAttribute(new YAttribute(YModelUtils.FREQUENCY, harvestingResult.getFrequency()));
    metadataModified = true;
  }
  List<YCategoryRef> refs = element.getCategoryRefs();
  if (shouldCategoryRefsBeAdded(harvestingResult, refs)) {
    refs.addAll(harvestingResult.getCategories());
    metadataModified = true;
  }
  if (shouldTitlesBeAdded(harvestingResult, element)) {
    metadataModified |= addTitleHistory(harvestingResult.getOtherTitles(), element);
  }
  return metadataModified;
}

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

for (LocalizedData<String> description : resource.getDescriptions()) {
  if (StringUtils.isNotEmpty(description.getData())) {
    yElement.addDescription(new YDescription(description.getLanguage().getyLanguage(), extractor.extractFrom(description.getData())));

代码示例来源:origin: pl.edu.icm.synat/synat-importer-speech-to-text

private void prepareYElementFromApi(Video video, YElement yElement) throws ParseException {
  yElement.addName(new YName(video.getSnippet().getTitle()));
  yElement.addDescription(new YDescription(YLanguage.Undetermined, video.getSnippet().getDescription()
          , DescriptionTypes.DS_SUMMARY));
  
  prepareDate(video, yElement);
  
  String license = video.getStatus().getLicense();
  if(null != license && license.contains("creativeCommon")) {
    yElement.addTagList(new YTagList().setType(YModelUtils.LICENSE).addValue("cc0"));
  }
  
  prepareContent(video, yElement);
  
  List<String> tags = video.getSnippet().getTags();
  if (CollectionUtils.isNotEmpty(tags)) {
    yElement.addTagList(new YTagList().setType(TagTypes.TG_KEYWORD).setValues(tags));
  }
  
  YCurrent currentLevel = new YCurrent().setLevel(VideoConstants.VIDEO_CURRENT_LEVEL);
  yElement.addStructure(new YStructure()
      .setHierarchy(HierarchyWithLevelIds.EXT_HIERARCHY_PUBLICATION)
      .setCurrent(currentLevel));
  
  prepareAttributes(video, yElement);
}

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

if(abstrakt!=null){
  if(abstrakt.getAbstractText()!=null){
    article.addDescription(new YDescription(YLanguage.English,xmc.getArticle().getAbstract().getAbstractText(),DescriptionTypes.DS_ABSTRACT));
if(otherAbstrakt!=null){
  if(otherAbstrakt.getAbstractText()!=null){
    article.addDescription(new YDescription(YLanguage.Undetermined,otherAbstrakt.getAbstractText(),DescriptionTypes.DS_ABSTRACT));
  if(generalNotes!=null){
    for(String note:generalNotes){
      article.addDescription(new YDescription(YLanguage.Undetermined,note, DescriptionTypes.DS_NOTE));

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com