Jump to content

Module:Sandbox/AbstractWikipedia/Renderers/he

From Meta, a Wikimedia project coordination wiki
Module documentation
local p = {}

-- The following is a list of templatic renderers for every constructor
-- For each constructur type (identified by its _predicate field) we have
-- a *main* template and possible sub-templates.

-- Each template can be realized as one of several variants. These variants
-- are conditioned on the validity field, which lists the arguments which must
-- be present. If none of the variants can be evaluated, the template is 
-- considered empty.

-- General structure of renderer:
--[[
p.RendererName = {
	main = { -- list of template variatns	
		{ -- variant 1
		  validity = { ... } -- list of mandatory arguments
		  roles = { ... }  -- possible grammatical roles
		  template = "..."   -- the actual template
		 },
		{ -- variant 2}, - etc.
	}
	some_sub_template = { } -- list of variants
	another_sub_template = { } -- etc.
}	
]]--

p.Person = {
	main = { 
		{
		template = '{root:description}. {cross:dates}.'
		},
	},
	description = { 
		{
			validity = { "person", "origin" },
			template = '{tsubj:Person(person)} {root:Copula()} {acomp:opt_occupation} {amod<acomp:Demonym(origin)}.'
		} 
	},
	opt_occupation = { 
		{
			validity = { "occupation" },
			template = '{occupation}'
		} 
	},
	dates = {
		{
			validity = {"birth", "death"},
			template = '{subj:Pronoun()} {root:birth} {L718716}{conj:death}'
		},
		{
			validity = {"birth"},
			template = '{subj:Pronoun()} {root:birth}'
		},
		{
			validity = {"death"},
			template = '{subj:Pronoun()} {root:death}'
		},
	}
}

p.List = {
	main = {
		{
			validity = {"first", "second"},
			-- Note that the second element may have an optional article added
			-- depending on the definite status of the first one.
			template = "{root:first} {L718716}{det:OptArt()}{conj:second}"
		}
	}
}

p.Birth = {
	main = { 
		{
			validity = {"date", "place"},
			-- L214265 - נולד
			template = '{root:Lexeme(L214265,Q1994301)} {In()} {Date(date)} {In()} {place}'
		}, 
		{
		validity = {"place"},
		template = '{root:Lexeme(L214265,Q1994301)} {In()} {place}'
		}, 
	}
}

p.Death = {
	-- L213977 - מת
	main = { 
		{
		validity = {"date", "place"},
		template = '{root:Lexeme(L213977,Q1994301)} {In()} {Date(date)} {In()} {place}'
		}, 
		{
		validity = {"place"},
		template = '{root:Lexeme(L213977,Q1994301)} {In()} {place}'
		}, 
	}
}

p.Pioneer = {
	main = { 
		{
			validity = {"in_what"},
			roles = {"pobj", "obj"},
			template = '{root:L719290} {In()} {pobj:in_what}'
		},
		{
			validity = {"person", "in_what"},
			template = "{tsubj:Person(person)} {root:Copula()} {acomp:L77816} {In()} {pobj<acomp:in_what}."
		}
	}
}

p.Research = {
	main = { 
		{
			validity = {"research_field"},
			roles = {"subj", "pobj", "obj"},  -- nominal positions
			-- The use of the definite article should actually be conditional
			-- as the research_field may already be determined, but I keep it
			-- simple for now.
			template = "חקר {det:Art()}{root:research_field}",
		},
		{
			validity = {"person", "pronominalize", "research_field"},
			-- L211118 חקר (to research)
			template = "{tsubj:Pronoun(person)} {root:L211118} {obj:research_field}."
		},
		{
			validity = {"person", "research_field"},
			template = "{tsubj:Person(person)} {root:L211118} {obj:research_field}."
		},
		
	}
}

p.AwardedPrize = {
	main = {
		{
			validity = {"prize"},
			-- L210450 זכה (to win)
			template = "{subj:PersonOrPronoun(person,pronominalize)} {root:Lexeme(L210450,Q442485)} {In()} {pobj:prize} {opt_date}, {opt_with}, {opt_reason}."
		}
	},
	opt_with = {
		{
			validity = {"with"},
			template = "יחד עם {with}"
		}
	},
	opt_reason = {
		{ 
			validity = {"reason"},
			template = '{root:"על"} {pobj:reason}'
		}
	},
	opt_date = {
		{
			validity = {"date"},
			template = "{In()} {Date(date)}"
		}
	},
}

p.Discovery = {
	main = {
		{
			roles = {"pobj", "obj", "subj"},
			validity = {"discovery"},
			template =	"גילוי"..
						" {det:Art()}{root:discovery}"
		},
		{
			validity = {"discovery"},
			-- L206208: to discover
			template = "{subj:PersonOrPronoun(person,pronominalize)} {root:Lexeme(L206208,Q442485)} {obj:discovery}."
		}
	}
}

p.Rank = {
	main = {
		-- Note that when a reference group is given, the ordinal agrees with that noun
		-- Otherwise it agrees with the subject.
		{
			validity = {"rank", "activity", "reference_group"},
			template = "{tsubj:PersonOrPronoun(person,pronominalize)} {root:Copula()} {Art()} {num:reference_group} {Art()} {amod<num:Ordinal(rank)} {L719306} {cross:activity}."
		},
		{
			validity = {"rank", "activity"},
			template = "{tsubj:PersonOrPronoun(person,pronominalize)} {root:Copula()} {Art()} {acomp:Ordinal(rank)} {L719306} {cross:activity}."
		},
	},
}

return p