citeproc-hs-0.3.8: A Citation Style Language implementation in Haskell

Portability | unportable
Stability | unstable
Maintainer | Andrea Rossato <andrea.rossato@unitn.it>
Safe Haskell | None

Text.CSL.Proc.Disamb

Description

This module provides functions for processing the evaluated `Output` for citation disambiguation.

Describe the disambiguation process.

Synopsis

- disambCitations :: Style -> [Reference] -> Citations -> [CitationGroup] -> ([(String, String)], [CitationGroup])
- mapDisambData :: (Output -> Output) -> CiteData -> CiteData
- mapCitationGroup :: ([Output] -> [Output]) -> CitationGroup -> CitationGroup
- data GiveNameDisambiguation
  - = NoGiven
  - | ByCite
  - | AllNames
- disambAddNames :: GiveNameDisambiguation -> [CiteData] -> [CiteData]
- disambAddGivenNames :: [NameData] -> [NameData]
- updateContrib :: GiveNameDisambiguation -> [CiteData] -> [NameData] -> Output -> Output
- updateOName :: [NameData] -> Output -> Output
- reEvaluate :: Style -> [CiteData] -> [(Cite, Reference)] -> CitationGroup -> CitationGroup
- hasIfDis :: IfThen -> [Bool]
- getCitDisambOptions :: Style -> [String]
- getDuplCiteData :: Bool -> Bool -> [CitationGroup] -> [[CiteData]]
- rmExtras :: [Output] -> [Output]
- getCiteData :: Output -> [CiteData]
- getYears :: Output -> [(String, String)]
- getDuplNameData :: [CitationGroup] -> [[NameData]]
- getDuplNames :: [CitationGroup] -> [[Output]]
- getName :: Output -> [NameData]
- generateYearSuffix :: [Reference] -> [(String, [Output])] -> [(String, String)]
- setYearSuffCollision :: Bool -> [CiteData] -> [Output] -> [Output]
- updateYearSuffixes :: [(String, String)] -> Output -> Output
- getYearSuffixes :: Output -> [(String, [Output])]
- rmYearSuff :: [CitationGroup] -> [CitationGroup]
- disambiguate :: Eq a => [[a]] -> [[a]]
- same :: Eq a => [a] -> [Bool]
- hasDuplicates :: Eq a => [a] -> Bool
- allTheSame :: Eq a => [a] -> Bool

# Documentation

disambCitations :: Style -> [Reference] -> Citations -> [CitationGroup] -> ([(String, String)], [CitationGroup])

Given the `Style`, the list of references and the citation groups, disambiguate citations according to the style options.

mapDisambData :: (Output -> Output) -> CiteData -> CiteData

mapCitationGroup :: ([Output] -> [Output]) -> CitationGroup -> CitationGroup

data GiveNameDisambiguation

Constructors

NoGiven |
ByCite |
AllNames |

Instances

Eq GiveNameDisambiguation |
Show GiveNameDisambiguation |

disambAddNames :: GiveNameDisambiguation -> [CiteData] -> [CiteData]

disambAddGivenNames :: [NameData] -> [NameData]

updateContrib :: GiveNameDisambiguation -> [CiteData] -> [NameData] -> Output -> Output

updateOName :: [NameData] -> Output -> Output

reEvaluate :: Style -> [CiteData] -> [(Cite, Reference)] -> CitationGroup -> CitationGroup

Evaluate again a citation group with the `EvalState` `disamb` field set to `True` (for matching the `"disambiguate"` condition).

hasIfDis :: IfThen -> [Bool]

Check if the `Style` has any conditional for disambiguation. In this case the conditional will be try after all other disambiguation strategies have failed. To be used with the generic `query` function.

getCitDisambOptions :: Style -> [String]

Get the list of disambiguation options set in the `Style` for citations.

getDuplCiteData :: Bool -> Bool -> [CitationGroup] -> [[CiteData]]

Group citation data (with possible alternative names) of citations which have a duplicate (same `collision`, and same `citYear` if year suffix disambiiguation is used). If the first `Bool` is `False`, then we need to retrieve data for year suffix disambiguation. The second `Bool` is `True` when comparing both year and contributors' names for finding duplicates (when the year-suffix option is set).

rmExtras :: [Output] -> [Output]

getCiteData :: Output -> [CiteData]

For an evaluated citation get its `CiteData`. The disambiguated citation and the year fields are empty. Only the first list of contributors' disambiguation data are collected for disambiguation purposes.

getYears :: Output -> [(String, String)]

getDuplNameData :: [CitationGroup] -> [[NameData]]

getDuplNames :: [CitationGroup] -> [[Output]]

getName :: Output -> [NameData]

generateYearSuffix :: [Reference] -> [(String, [Output])] -> [(String, String)]

setYearSuffCollision :: Bool -> [CiteData] -> [Output] -> [Output]

updateYearSuffixes :: [(String, String)] -> Output -> Output

getYearSuffixes :: Output -> [(String, [Output])]

rmYearSuff :: [CitationGroup] -> [CitationGroup]

disambiguate :: Eq a => [[a]] -> [[a]]

Try to disambiguate a list of lists by returning the first non colliding element, if any, of each list:

     disambiguate [[1,2],[1,3],[2]] = [[2],[3],[2]]

same :: Eq a => [a] -> [Bool]

For each element a list of `Bool`: `True` if the element has a duplicate in the list:

     same [1,2,1] = [True,False,True]

hasDuplicates :: Eq a => [a] -> Bool

allTheSame :: Eq a => [a] -> Bool