Jump to content

Web2Cit/Docs/Fields

From Meta, a Wikimedia project coordination wiki

Web2Cit translation fields are each of the citation metadata fields supported by Web2Cit. Translation templates and translation tests define translation procedures and translation goals, respectively, for each of these translation fields.

Each translation field type is described by:

  • A field name.
  • A validation pattern, used to decide whether a template field output or a test field goal are valid or not.
  • A mapping to a specific Citoid/Zotero citation field, used to produce a citation for a target webpage from an applicable translation template, as described in the Templates documentation.

Note that field descriptions are ultimately defined in the params property of Web2Cit Core's TranslationField class.

In addition, each field type:

  • May or not be mandatory, indicating whether it must always be included as required in translation templates (see Templates documentation).
  • Relies on a specific comparison function to calculate a translation test score (see Tests documentation).

Translation field types

[edit]

We currenty support the following field types:

  • Item type: the type of the cited resource.
    • fieldname: itemType
    • validation: a single value matching any of the supported Citoid/Zotero item types[note 1]. See your Wikipedia's Citoid-template-type-map.json configuration file (e.g., English Wikipedia's) to find out what citation template will be used for each item type.
    • mapping: mapped to Citoid/Zotero itemType
    • mandatory: yes
    • comparison: Boolean
  • Title: the title of the cited resource.
    • fieldname: title
    • validation: a single non-empty string (see T313236 for a problem this pattern may cause)
    • mapping: mapped to Citoid/Zotero title
    • mandatory: yes
    • comparison: Edit distance
  • Author first names: the first names of the cited resource's authors (for author names where splitting between first and last names makes sense)
    • fieldname: authorFirst
    • validation: a list of one or more strings (empty strings are OK)
    • mapping: mapped to Citoid/Zotero author's first names
    • mandatory: no
    • comparison: Edit distance
  • Author last or full names: the last names of the cited resource's authors; or the full names, for author names where splitting between first and last name does not make sense
    • fieldname: authorLast
    • validation: a list of one or more non-empty strings
    • mapping: mapped to Citoid/Zotero author's last names
    • mandatory: no
    • comparison: Edit distance
  • Publication date: the date when the cited resource was published
    • fieldname: date
    • validation: a single value matching one of YYYY-MM-DD, YYYY-MM, or YYYY.
    • mapping: mapped to Citoid/Zotero date
    • mandatory: no
    • comparison: Date
  • Published in: the name of the work containing the cited resource; for example the newspaper name for a newspaper article
    • fieldname: publishedIn
    • validation: a single non-empty string
    • mapping: mapped to Citoid/Zotero publicationTitle, reporter and code (all mapped to CSL "container-title")[note 1]
    • mandatory: no
    • comparison: Edit distance
  • Published by: the publisher of the cited resource
    • fieldname: publishedBy
    • validation: a single non-empty string
    • mapping: mapped to Citoid/Zotero publisher
    • mandatory: no
    • comparison: Edit distance
  • Language: the locale identifier for the language of the cited resource
  • Control: a field that can be used to control whether a template may be applied on a target webpage or not based on the webpage's contents. Note that this field may only be used in translation templates (i.e., not in translation tests).
    • fieldname: control
    • validation: a single string, empty or non-empty
    • mapping: not mapped to any Citoid/Zotero fields
    • mandatory: no
    • comparison: n/a

Notes

[edit]