<commit_before>'use strict';

const Parser = require('../../parser');

module.exports = function(language) {
	return new Parser(language)

		.add(language.integer, v => v[0])
		.add([ language.integer, 'st' ], v => v[0])
		.add([ language.integer, 'nd' ], v => v[0])
		.add([ language.integer, 'rd' ], v => v[0])
		.add([ language.integer, 'th' ], v => v[0])

		.map(
			{
				'first': 1,
				'second': 2,
				'third': 3,
				'fourth': 4,
				'fifth': 5,
				'sixth': 6,
				'seventh': 7,
				'eight': 8,
				'ninth': 9,
				'tenth': 10
			},
			l => { return { value: l } }
		)

		.onlyBest()
		.mapResults(r => {
			const mapped = {
				value: r.value
			};
			return mapped;
		});
}<commit_msg>Allow ordinals to match `the` at the start<commit_after>'use strict';

const Parser = require('../../parser');

module.exports = function(language) {
	return new Parser(language)

		.add(language.integer, v => v[0])
		.add([ language.integer, 'st' ], v => v[0])
		.add([ language.integer, 'nd' ], v => v[0])
		.add([ language.integer, 'rd' ], v => v[0])
		.add([ language.integer, 'th' ], v => v[0])

		.map(
			{
				'first': 1,
				'second': 2,
				'third': 3,
				'fourth': 4,
				'fifth': 5,
				'sixth': 6,
				'seventh': 7,
				'eight': 8,
				'ninth': 9,
				'tenth': 10
			},
			l => { return { value: l } }
		)

		.add([ 'the', Parser.result() ], v => v[0])

		.onlyBest()
		.mapResults(r => {
			const mapped = {
				value: r.value
			};
			return mapped;
		});
}
{'fraction_non_alphanumeric': 0.23129251700680273, 'fraction_numerical': 0.022448979591836733, 'mean_word_length': 2.485781990521327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7520317', 'n_tokens_mistral': 723, 'n_tokens_neox': 579, 'n_words': 144}