Compare commits

..

No commits in common. "ztm" and "main" have entirely different histories.
ztm ... main

55 changed files with 834 additions and 16872 deletions

View File

@ -1,27 +0,0 @@
name: train-model
on:
workflow_dispatch:
inputs:
epochs:
description: 'Number of epochs for training'
required: true
default: '1'
jobs:
train:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use Docker action
id: train
uses: ./train-action/
with:
epochs: 1
- name: Archive
uses: actions/upload-artifact@v3
with:
name: model
path: model.keras

5
.gitignore vendored
View File

@ -2,10 +2,7 @@ languages.*.tsv
columns.pruned.tsv
columns.original.tsv
*.csv
*.tsv
src/csv2tsv/csv2tsv
csv2tsv/csv2tsv
.cache
compile_commands.json
tsv2json/tsv2json
normalize
data

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "aitech-ium"]
path = aitech-ium
url = https://git.wmi.amu.edu.pl/AITech/aitech-ium.git
[submodule "tsv2json/json"]
path = tsv2json/json
url = https://github.com/RobertBendun/ImmidiateJSON.git

View File

@ -1,5 +0,0 @@
FROM ubuntu:22.04
RUN apt update && apt install -y vim make python3 python3-pip python-is-python3 gcc g++ golang wget unzip git
RUN pip install pandas matplotlib scikit-learn tensorflow
CMD "bash"

36
Makefile Normal file
View File

@ -0,0 +1,36 @@
# Remove all columns according to specification in columns.pruned.tsv
languages.pruned.tsv: languages.original.tsv columns.user.tsv
bash -c "cut -f`grep '^y' columns.user.tsv | cut -f3 | paste -sd ','` $< >$@"
# Allow user to mark in which columns is interested
columns.user.tsv: columns.pruned.tsv
if [ -f $@ ]; then touch $@; else awk 'NR==1{ printf("Keep\tType\t"); print } NR>1{printf("n\tstr\t"); print}' $< >$@; fi
# Prune columns that are not needed to create specification
columns.pruned.tsv: columns.original.tsv
cut --complement -f3,4,5,7,8,9,10 $< >$@
# Change data to TSV format since it is easier to process using standard UNIX tools
%.tsv: %.csv
csv2tsv/csv2tsv <$< >$@
# Check while downloading that file is as expected.
# Otherwise automatic filter mechanism wouldn't work.
# If hashes differ then user of this repo must migrate columns.user.tsv to a new format
columns.original.csv:
wget 'https://pldb.com/columns.csv' -O $@
sha256sum -c checksums.sha256
languages.original.csv: columns.original.csv
wget 'https://pldb.com/languages.csv' -O $@
clean:
rm -f languages.*.tsv languages.*.csv columns.original.tsv columns.*.csv columns.pruned.tsv
csv2tsv/csv2tsv: csv2tsv/csv2tsv.go
cd csv2tsv; go build
tsv2json/tsv2json: tsv2json/tsv2json.cc
g++ -std=c++20 -O0 -Wall -Wextra -o $@ $< -ggdb
.PHONY: clean

View File

@ -1,3 +0,0 @@
![frequency of departures at given hour](./pics/departure_time_frequency.png)
![popularity of trip destinations](./pics/stop_headsign_popularity.png)

@ -1 +1 @@
Subproject commit 8264284fd7c2217c41bbb59732ed4a559d6f24da
Subproject commit 855ca79293d0bfaec6d144651030d304db9242af

1
checksums.sha256 Normal file
View File

@ -0,0 +1 @@
27afba98520ff7c408492cab9ea8789db223ae8c134cb0cd6dfbebf7c7132100 columns.original.csv

354
columns.user.tsv Normal file
View File

@ -0,0 +1,354 @@
Keep Type Index Column Description
y lower 1 title The official title of the language
y int 2 appeared What year was the language publicly released and/or announced?
y lower 3 type Which category in PLDB's subjective ontology does this entity fit into.
y lower 4 pldbId computed
y int 5 rank computed
y int 6 languageRank computed
y int 7 factCount computed
y int 8 lastActivity computed
y int 9 exampleCount computed
y int 10 bookCount computed
y int 11 paperCount computed
y int 12 numberOfUsers computed
y int 13 numberOfJobs computed
y int 14 githubBigQuery.repos How many repos for this language are listed in Google's BigQuery Public GitHub Dataset snapshot.
y sep(" and ").lower 15 creators Name(s) of the original creators of the language delimited by " and "
y bool 16 githubRepo URL of the official GitHub repo for the project if it hosted there.
y bool 17 website URL of the official homepage for the language project.
y bool 18 wikipedia URL of the entity on Wikipedia, if and only if it has a page dedicated to it.
y sep(" && ").lower 19 originCommunity In what community(ies) did the language first originate?
y lower.unless("various").sep(" and ") 20 country What country was the language first developed in?
n Type 21 centralPackageRepositoryCount If you've searched for a CPM for this language and can't find one, set 0 as the count.
n Type 22 reference A link to more info about this entity. You can add raw links and then auto "upgrade" them using some of the importer code.
n Type 23 hopl The matching language on Diarmuid Pigott's Online Historical Encyclopaedia of Programming Languages site (https://hopl.info/)
n Type 24 wikipedia.dailyPageViews How many page views per day does this Wikipedia page get? Useful as a signal for rankings. Available via WP api.
y int 25 wikipedia.backlinksCount How many pages on WP link to this page?
n Type 26 wikipedia.summary What is the text summary of the language from the Wikipedia page?
n Type 27 wikipedia.pageId Waht is the internal ID for this entity on WP?
y int 28 wikipedia.appeared When does Wikipedia claim this entity first appeared?
n Type 29 wikipedia.created When was the *Wikipedia page* for this entity created?
n Type 30 wikipedia.revisionCount How many revisions does this page have?
n Type 31 wikipedia.related What languages does Wikipedia have as related?
n Type 32 fileType What is the file encoding for programs in this language?
n Type 33 isbndb Books about this language from ISBNdb.
y int 34 githubRepo.stars How many stars of the repo?
y int 35 githubRepo.forks How many forks of the repo?
y int 36 githubRepo.updated What year was the last commit made?
y int 37 githubRepo.subscribers How many subscribers to the repo?
n Type 38 githubRepo.created When was the *Github repo* for this entity created?
n Type 39 githubRepo.description Description of the repo on GitHub.
n Type 40 description Description of the repo on GitHub.
n Type 41 githubRepo.issues How many isses on the repo?
n Type 42 domainName If the project website is on its own domain.
y int 43 githubRepo.firstCommit What year the first commit made in this git repo?
n Type 44 semanticScholar Papers about this language from Semantic Scholar.
y bool 45 features.hasComments
n Type 46 domainName.registered When was this domain first registered?
n Type 47 isOpenSource Is it an open source project?
y bool 48 features.hasSemanticIndentation
y bool 49 features.hasLineComments
n Type 50 githubLanguage GitHub has a set of supported languages as defined here: https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml
n Type 51 githubLanguage.tm_scope The TextMate scope that represents this programming language. This should match one of the scopes listed in the grammars.yml file. Use "none" if there is no grammar for this language.
n Type 52 githubLanguage.type Either data, programming, markup, prose, or nil.
n Type 53 githubLanguage.ace_mode A String name of the Ace Mode used for highlighting whenever a file is edited. This must match one of the filenames in http://git.io/3XO_Cg. Use "text" if a mode does not exist.
n Type 54 githubLanguage.fileExtensions An Array of associated extensions (the first one is considered the primary extension, the others should be listed alphabetically).
n Type 55 numberOfRepos computed
n Type 56 githubLanguage.repos How many repos for this language does GitHub report?
n Type 57 lineCommentToken Defined as a token that can be placed anywhere on a line and starts a comment that cannot be stopped except by a line break character or end of file.
n Type 58 githubLanguage.trendingProjectsCount How many trending repos for this language does GitHub report?
n Type 59 domainName.awisRank.2022
n Type 60 leachim6.filepath
n Type 61 leachim6 A link to this language in leachim6's hello-world project.
n Type 62 githubBigQuery Google BigQuery Public Datasets has a dataset with info on GitHub repos: https://cloud.google.com/blog/topics/public-datasets/github-on-bigquery-analyze-all-the-open-source-code
n Type 63 githubBigQuery.users
n Type 64 linguistGrammarRepo Linguist is a library used by GitHub to syntax highlight files on GitHub via a grammar. The list of languages supported by Linguist and the grammar package used for each language is listed here: https://github.com/github/linguist/blob/master/vendor/README.md. If Linguist has support for a language, it will have a repo on GitHub. Given a language is supported by Linguist, that is a good indication it has at least 200 unique :user/:repo repositories, according to their docs.
n Type 65 linguistGrammarRepo.commitCount How many commits in this repo?
n Type 66 linguistGrammarRepo.committerCount How many people have made commits in this repo?
n Type 67 linguistGrammarRepo.lastCommit What year was the last commit made?
n Type 68 linguistGrammarRepo.firstCommit What year was the first commit made?
n Type 69 wordRank Some creators use a common English word as their language's name. For these we note how common the word is, where "the" is 1.
n Type 70 leachim6.fileExtensions An Array of associated extensions (the first one is considered the primary extension, the others should be listed alphabetically).
n Type 71 linguistGrammarRepo.sampleCount How many language samples in this repo?
y bool 72 features.hasStrings
n Type 73 pygmentsHighlighter.filename
n Type 74 pygmentsHighlighter A link to a Pygments syntax highlighting class for this language (https://pygments.org/)
n Type 75 standsFor If the language name is an acronym what does/did it stand for?
n Type 76 stringToken What token(s) is used to delimite a string?
n Type 77 documentation Link to the official documentation for a language.
n Type 78 rosettaCode A link to this language on Rosetta Code - http://www.rosettacode.org/
n Type 79 pygmentsHighlighter.fileExtensions An Array of associated extensions (the first one is considered the primary extension, the others should be listed alphabetically).
y bool 80 features.hasPrintDebugging
n Type 81 printToken What token(s) is used to print a message?
n Type 82 twitter Official Twitter handle of the entity, if any.
y bool 83 features.hasMultiLineComments
n Type 84 rijuRepl A link to try this language on riju.codes
n Type 85 githubLanguage.codemirror_mime_type A String name of the file mime type used for highlighting whenever a file is edited. This should match the `mime` associated with the mode from https://git.io/f4SoQ
n Type 86 githubLanguage.codemirror_mode A String name of the CodeMirror Mode used for highlighting whenever a file is edited. This must match a mode from https://git.io/vi9Fx
y sep(" ") 87 fileExtensions An Array of associated extensions (the first one is considered the primary extension, the others should be listed alphabetically).
n Type 88 tiobe Tiobe maintains a well known ranking of programming languages here: https://www.tiobe.com/tiobe-index/
y sep(" ") 89 related What languages are related? This serves as a catch all, and it is better to use a more specific relationship node such as "supersetOf".
y str 90 multiLineCommentTokens A comment with a start delimiter and end token (which can be the same) that can span multiple lines.
n Type 91 aka Another name for the language. Entries can have multiple aka lines.
y bool 92 features.hasIntegers
n Type 93 helloWorldCollection Hello world written in this language from http://helloworldcollection.de/
n Type 94 githubLanguage.aliases An Array of additional aliases (implicitly includes name.downcase).
y bool 95 features.hasFloats
n Type 96 tryItOnline A link to try this language on https://tio.run
y sep(" ") 97 writtenIn What language(s) is the main implementation written in?
y bool 98 features.hasBooleans
n Type 99 keywords What are all the keywords in this language?
n Type 100 indeedJobs How many job descriptions match this query for this language on indeed.com?
n Type 101 wikipedia.fileExtensions An Array of associated extensions (the first one is considered the primary extension, the others should be listed alphabetically).
y bool 102 features.hasHexadecimals
n Type 103 projectEuler.memberCount.2022
n Type 104 projectEuler Is this language one of the ones listed on https://projecteuler.net/?
n Type 105 booleanTokens What token(s) is used for true and false?
n Type 106 visualParadigm Is this a visual programming thing? Sometimes called "no code" or "low code"?
n Type 107 domainName.awisRank.2017
n Type 108 projectEuler.memberCount.2019
n Type 109 webRepl An online repl for the project.
n Type 110 subreddit.memberCount.2022
n Type 111 subreddit Url of a subreddit(s) for this language.
n Type 112 codeMirror A link to a CodeMirror syntax highlighting package for this language (https://github.com/codemirror/codemirror5/tree/master/mode/LANGUAGE)
y bool 113 features.hasCaseInsensitiveIdentifiers
n Type 114 monaco A link to a Monaco syntax highlighting package for this language.
y bool 115 features.hasConditionals
n Type 116 jupyterKernel A link to a Jupyter Kernel for this language.
n Type 117 githubLanguage.interpreters An Array of associated interpreters
n Type 118 quineRelay The Quine Relay project (https://github.com/mame/quine-relay).
n Type 119 compilesTo Which language(s) does this language primarily compile to?
n Type 120 ubuntuPackage The name of an Ubuntu package for the language from https://packages.ubuntu.com/.
n Type 121 indeedJobs.2022
n Type 122 packageRepository URL to the package repository for this language.
n Type 123 antlr A link to the ANTLR grammar for this language (https://github.com/antlr/grammars-v4/tree/master/LANGUAGE)
n Type 124 officialBlogUrl URL to the official blog for this language.
n Type 125 meetup.groupCount
n Type 126 meetup.memberCount
n Type 127 meetup Some languages have active meetup groups on Meetup.com
n Type 128 linkedInSkill.2018
n Type 129 linkedInSkill How many people list this skill on LinkedIn?
n Type 130 languageServerProtocolProject A link to a project implementing LSP for this language.
n Type 131 githubLanguage.filenames Filenames commonly associated with the language.
y bool 132 features.hasOctals
n Type 133 releaseNotesUrl URL to the release notes for this language.
n Type 134 languageServerProtocolProject.writtenIn What language(s) is the main implementation written in?
y bool 135 features.hasAssignment
n Type 136 faqPageUrl URL to the frequently asked questions for this language.
n Type 137 tiobe.currentRank What is the current Tiobe rank of this language?
y bool 138 features.hasWhileLoops
n Type 139 forLanguages Which languages is this repository for?
n Type 140 packageCount How many packages are in the repository? A package is some code with a name and a namespace, shipped as an atomic unit, with an owner(s).
y sep(" ") 141 supersetOf Is this language a superset of another? If you specify this link then the superset language will inherit all features of subset language.
n Type 142 indeedJobs.2017
y bool 143 features.hasBinaryNumbers
y sep(" ") 144 influencedBy What languages influenced this one?
y bool 145 features.hasOperatorOverloading
y bool 146 features.hasImports
y bool 147 features.hasFunctions
n Type 148 githubLanguage.group Name of the parent language. Languages in a group are counted in the statistics as the parent language.
n Type 149 rijuRepl.description Description of the repo on GitHub.
n Type 150 subreddit.memberCount.2017
n Type 151 rijuRepl.gitRepo URL of the official git repo for the language project if not hosted on GitHub or GitLab or Sourcehut.
n Type 152 rijuRepl.fileExtensions An Array of associated extensions (the first one is considered the primary extension, the others should be listed alphabetically).
n Type 153 stackOverflowSurvey.2021.percentageUsing What percentage of survey respondents report using this language?
n Type 154 stackOverflowSurvey.2021.fans How many developers reported wanting to learn this language.
n Type 155 stackOverflowSurvey.2021.medianSalary Median salary reported by developers using this language.
n Type 156 stackOverflowSurvey.2021.users How many developers reported using this language.
n Type 157 downloadPageUrl URL to the download page for this language.
n Type 158 assignmentToken What token(s) is used for assignment to an identifier?
n Type 159 compilerExplorer This language's name on https://godbolt.org
y bool 160 features.hasMacros
y bool 161 features.hasClasses
n Type 162 replit A link to try this language on replit.com
n Type 163 rijuRepl.website URL of the official homepage for the language project.
n Type 164 pypl This language's id on https://pypl.github.io
n Type 165 emailList Link to the mailing list for a language.
y bool 166 features.hasTypeInference
y bool 167 features.isCaseSensitive
y bool 168 features.hasSwitch
y bool 169 features.hasConstants
y bool 170 features.hasGarbageCollection
n Type 171 spec Link to the official spec for a language.
y bool 172 features.hasExceptions
y bool 173 features.hasPointers
y bool 174 features.hasDirectives
y bool 175 features.hasAccessModifiers
n Type 176 eventsPageUrl URL to the events pages of this language.
n Type 177 cheatSheetUrl A link to a cheat sheet for this language.
y bool 178 features.hasLists
y bool 179 features.hasInheritance
n Type 180 esolang A link to this language on https://esolangs.org/
n bool 181 features.hasMultipleInheritance
y bool 182 features.hasConstructors
n Type 183 nativeLanguage Nearly all programming languages are written in English, but some aren't. Set this field for the ones that are not.
y bool 184 features.hasRegularExpressionsSyntaxSugar
n Type 185 screenshot For visual languages, a picture is worth a thousand words. Provide the URL to the screenshot in the form: https://pldb.com/screenshots/[pldbId].png
n Type 186 githubLanguage.wrap Boolean wrap to enable line wrapping (default: false)
y bool 187 features.isLisp Is this in the Lisp family of languages?
y bool 188 features.hasTernaryOperators
y bool 189 features.hasScientificNotation
n Type 190 versions.2022 A release year and version. Perhaps in the future we could get more specific to month or even day.
y bool 191 features.hasMessagePassing
n Type 192 gdbSupport Is the language supported by the GNU Debugger?
y bool 193 features.hasEnums
n Type 194 announcementMethod How was the language first announced?
n Type 195 gitlabRepo URL of the official GitLab repo for the language project.
n Type 196 demoVideo Provide a url of a demo video of the language.
n Type 197 isPublicDomain Is it public domain?
y bool 198 features.hasMultilineStrings
y bool 199 features.hasVariableSubstitutionSyntax Do you use different syntax when assigning versus referencing a variable?
y sep(" ") 200 subsetOf Is this language a subset of another?
n Type 201 firstAnnouncement A url announcing the creation or release of a new language
n Type 202 packageInstallCount How many packages have been downloaded?
y bool 203 features.canWriteToDisk
y bool 204 features.hasBitWiseOperators
y bool 205 features.hasZeroBasedNumbering
n Type 206 oldName What is the old name of this language?
y bool 207 features.hasStaticTyping
y bool 208 features.hasUnitsOfMeasure
y bool 209 features.hasIncrementAndDecrementOperators
y bool 210 features.hasSingleDispatch
y bool 211 features.hasHomoiconicity
n Type 212 runsOnVm What virtual machine(s) does this language run on?
y bool 213 features.hasHereDocs
y bool 214 features.hasFixedPoint
y bool 215 features.hasNamespaces
y bool 216 features.hasThreads
y bool 217 features.hasModules
n Type 218 gitRepo URL of the official git repo for the language project if not hosted on GitHub or GitLab or Sourcehut.
y bool 219 features.hasPatternMatching
y bool 220 features.hasGotos
n Type 221 annualReportsUrl URL to the annual reports for this language.
y bool 222 features.hasFunctionComposition
y bool 223 features.hasFunctionOverloading
y bool 224 features.hasAsyncAwait
y bool 225 features.hasIterators
y bool 226 features.hasExplicitTypeCasting
y bool 227 features.hasStructs
y bool 228 features.hasMultipleDispatch
y bool 229 features.hasInterfaces
y bool 230 features.hasGenerics
y bool 231 features.hasForEachLoops
y bool 232 features.hasMaps
y bool 233 features.hasPipes
y bool 234 features.hasMixins
y bool 235 features.canDoShebang
y bool 236 features.hasVariadicFunctions
y bool 237 features.hasManualMemoryManagement
y bool 238 features.hasTemplates
y bool 239 features.hasInfixNotation
y bool 240 features.hasPolymorphism
y bool 241 features.hasPartialApplication
y bool 242 features.hasAssertStatements
n Type 243 sourcehutRepo URL of the official sourcehut repo for the project.
y bool 244 features.hasForLoops
n Type 245 renamedTo What is the new name of this language?
y bool 246 features.hasDocComments Is there a standard mini language written in comments for documenting code?
y bool 247 features.hasUnicodeIdentifiers
y bool 248 features.hasDependentTypes
n Type 249 conference Some languages have a recurring conference(s) focused on that specific language.
y bool 250 features.hasDuckTyping
y bool 251 features.hasDefaultParameters
y bool 252 features.hasAnonymousFunctions
y bool 253 features.hasMagicGettersAndSetters
n Type 254 packageAuthors How many people contribute packages to this cpm?
n Type 255 photo For notations, a picture is worth a thousand words. Provide a photo in the form: https://pldb.com/photos/[pldbId].png
n Type 256 successorOf Was this language launched as the successor of another?
y bool 257 features.hasBuiltInRegex
y bool 258 features.hasNull
y bool 259 features.hasUnaryOperators
y bool 260 features.hasUserDefinedOperators
y bool 261 features.hasBreak
y bool 262 features.hasContinue
n Type 263 includeToken What token(s) is used for including another file?
y bool 264 features.hasUnionTypes
y bool 265 features.hasSingleTypeArrays Has an array data structure that only can hold items of the same type.
y bool 266 features.hasTypedHoles
y bool 267 features.hasReservedWords Does a concept of reserved words exists? For example, not being able to use certain keywords as variable names.
y bool 268 features.hasRangeOperators
y bool 269 features.hasDisposeBlocks
y bool 270 features.hasSymbolTables
y bool 271 features.hasDestructuring
y bool 272 features.hasGenerators
y bool 273 features.hasDynamicProperties
y bool 274 features.hasExpressions
y sep(" ") 275 forkOf What language is this language a fork of?
n Type 276 inputLanguages Which language(s) does this take as input? For compilers, what languages does this compile compile?
n Type 277 redditDiscussion A link to a related discussion on reddit.
y bool 278 features.hasTryCatch
y bool 279 features.hasEscapeCharacters
y bool 280 usesSemanticVersioning Does the official release of the language use semantic versioning?
y bool 281 features.hasPostfixNotation
y bool 282 features.hasPrefixNotation
y bool 283 features.hasStreams
y bool 284 features.hasLazyEvaluation
y bool 285 features.hasCharacters
n Type 286 funFact A text or code block containing a fun or unusual fact about the language.
y bool 287 features.hasSets
y bool 288 features.hasMethods
y bool 289 features.hasAbstractTypes
y bool 290 isDead Has the creator or maintainer announced it officially dead? Include a link to proof of the announcement.
y bool 291 features.canUseQuestionMarksAsPartOfIdentifier
y bool 292 features.hasTypeAnnotations
y bool 293 features.hasSymbols
y bool 294 features.hasDecimals
y bool 295 features.hasBlobs
y bool 296 features.hasSExpressions
y bool 297 features.hasLabels
y bool 298 features.hasIfElses
y bool 299 features.hasIfs
y bool 300 features.hasBoundedCheckedArrays
y bool 301 features.hasArraySlicingSyntax
y bool 302 features.hasTimestamps
y bool 303 features.hasMethodOverloading
y bool 304 features.hasVoidFunctions
y bool 305 features.hasGlobalScope
y bool 306 features.hasFnArguments
y bool 307 features.canReadCommandLineArgs
y bool 308 features.hasDynamicSizedArrays
y bool 309 features.hasRequiredMainFunction
y bool 310 features.hasSelfOrThisWord
n bool 311 features.hasStatementTerminatorCharacter
y bool 312 features.hasMemberVariables
y bool 313 features.hasStringConcatOperator
n Type 314 versions.2021 A release year and version. Perhaps in the future we could get more specific to month or even day.
y bool 315 features.hasAlgebraicTypes
y bool 316 features.hasTypeParameters
y bool 317 features.hasStaticMethods
y bool 318 features.hasRunTimeGuards
n Type 319 irc Link to official (or popular unofficial) IRC channel(s) for language development.
y bool 320 features.hasTraits
y bool 321 features.hasVirtualFunctions
n Type 322 discord Link to official (or popular unofficial) Discord for language development.
y bool 323 features.letterFirstIdentifiers Must identifiers start with a letter
y bool 324 features.hasReferences
y bool 325 features.hasImplicitTypeConversions
y bool 326 features.hasFirstClassFunctions
y bool 327 features.hasProcessorRegisters
y bool 328 features.hasSourceMaps
y bool 329 features.mergesWhitespace
y bool 330 features.supportsBreakpoints
y bool 331 features.hasMapFunctions
y bool 332 features.hasBinaryOperators
y bool 333 features.hasStatements
n Type 334 versions.2007 A release year and version. Perhaps in the future we could get more specific to month or even day.
n Type 335 versions.2023 A release year and version. Perhaps in the future we could get more specific to month or even day.
n Type 336 versions.2015 A release year and version. Perhaps in the future we could get more specific to month or even day.
n Type 337 versions.2019 A release year and version. Perhaps in the future we could get more specific to month or even day.
n Type 338 versions.2013 A release year and version. Perhaps in the future we could get more specific to month or even day.
y bool 339 features.hasRefinementTypes
y bool 340 features.hasPairs
y bool 341 features.hasValueReturnedFunctions
y bool 342 features.hasClobs
y bool 343 features.hasTriples
y bool 344 features.hasIds
n Type 345 ebook Link to a free eBook about this. Only include if the eBook is of high quality and not spammy.
y bool 346 features.hasExports
y bool 347 features.hasZippers
y bool 348 features.hasMonads
y sep(" ") 349 extensionOf What language is this language an extension of?
n Type 350 zulip Link to official (or popular unofficial) Zulip for language development.
y bool 351 features.hasImplicitArguments
y bool 352 features.hasDynamicTyping
y bool 353 features.hasMethodChaining
Can't render this file because it contains an unexpected character in line 16 and column 7.

View File

@ -1,22 +0,0 @@
node {
checkout scm
stage('Configuration')
def local_image = docker.build("s452639-image")
local_image.inside {
stage('Build') {
checkout([$class: 'GitSCM', branches: [[name: 'ztm']], extensions: [], userRemoteConfigs: [[url: 'https://git.wmi.amu.edu.pl/s452639/ium_452639']]])
sh 'cd src; ./prepare-ztm-data.sh'
archiveArtifacts artifacts: 'src/stop_times.normalized.tsv,src/stop_times.train.tsv,src/stop_times.test.tsv,src/stop_times.valid.tsv,src/stop_times.categories.tsv',
followSymlinks: false
}
}
stage('Trigger') {
build wait: false, job: 's452639-training'
}
}

View File

@ -1,8 +0,0 @@
name: ium
channels:
- defaults
dependencies:
- pandas
- tensorflow
- scikit-learn
- matplotlib

View File

@ -1,39 +0,0 @@
node {
checkout scm
def local_image = docker.build("s452639-image")
local_image.inside {
stage('Prepare accuracy log') {
try {
copyArtifacts projectName: currentBuild.projectName,
selector: specific("${currentBuild.previousBuild.number}"),
flatten: true,
target: 'src/'
} catch (err) {
echo("with new accuracy log")
}
}
stage('Evaluate') {
checkout([$class: 'GitSCM', branches: [[name: BRANCH_NAME]], extensions: [], userRemoteConfigs: [[url: 'https://git.wmi.amu.edu.pl/s452639/ium_452639']]])
copyArtifacts fingerprintArtifacts: true,
projectName: 's452639-create-dataset',
selector: lastSuccessful(),
flatten: true,
target: 'src/'
copyArtifacts fingerprintArtifacts: true,
projectName: "s452639-training/${BRANCH_NAME}",
selector: lastSuccessful(),
flatten: true,
target: 'src/'
sh 'cd src; python tf_test.py'
archiveArtifacts artifacts: 'src/stop_times.predictions.tsv,src/stop_times.accuracy.tsv'
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

View File

@ -1,34 +0,0 @@
acmart.cls
acmart.pdf
acmguide.pdf
samples/*.pdf
*.log
*.aux
*.cfg
*.glo
*.idx
*.toc
*.ilg
*.ind
*.out
*.lof
*.lot
*.bbl
*.blg
*.gls
*.cut
*.hd
*.dvi
*.ps
*.thm
*.tgz
*.zip
*.rpi
*~
*.bcf
*.run.xml
samples/ACM-Reference-Format.bst
samples/*.tex
samples/*.bbx
samples/*.cbx
samples/*.dbx

File diff suppressed because it is too large Load Diff

View File

@ -1,142 +0,0 @@
#
# Makefile for acmart package
#
# This file is in public domain
#
# $Id: Makefile,v 1.10 2016/04/14 21:55:57 boris Exp $
#
PACKAGE=acmart
PDF = $(PACKAGE).pdf acmguide.pdf
BIBLATEXFILES= $(wildcard *.bbx) $(wildcard *.cbx) $(wildcard *.dbx) $(wildcard *.lbx)
SAMPLEBIBLATEXFILES=$(patsubst %,samples/%,$(BIBLATEXFILES))
all: ${PDF} ALLSAMPLES
%.pdf: %.dtx $(PACKAGE).cls
pdflatex $<
- bibtex $*
pdflatex $<
- makeindex -s gind.ist -o $*.ind $*.idx
- makeindex -s gglo.ist -o $*.gls $*.glo
pdflatex $<
while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log) \
do pdflatex $<; done
%.cls: %.ins %.dtx
pdflatex $<
ALLSAMPLES: $(SAMPLEBIBLATEXFILES)
cd samples; pdflatex samples.ins; cd ..
for texfile in samples/*.tex; do \
pdffile=$${texfile%.tex}.pdf; \
${MAKE} $$pdffile; \
done
samples/%: %
cp $^ samples
samples/$(PACKAGE).cls: $(PACKAGE).cls
samples/ACM-Reference-Format.bst: ACM-Reference-Format.bst
samples/abbrev.bib: ACM-Reference-Format.bst
perl -pe 's/MACRO ({[^}]*}) *\n/MACRO \1/' ACM-Reference-Format.bst \
| grep MACRO | sed 's/MACRO {/@STRING{/' \
| sed 's/} *{/ = /' > samples/abbrev.bib
samples/%.bbx: %.bbx
samples/%.cbx: %.cbx
samples/%.dbx: %.dbx
samples/%.lbx: %.lbx
samples/%.pdf: samples/%.tex samples/$(PACKAGE).cls samples/ACM-Reference-Format.bst
cd $(dir $@) && pdflatex-dev $(notdir $<)
- cd $(dir $@) && bibtex $(notdir $(basename $<))
cd $(dir $@) && pdflatex-dev $(notdir $<)
cd $(dir $@) && pdflatex-dev $(notdir $<)
while ( grep -q '^LaTeX Warning: Label(s) may have changed' $(basename $<).log) \
do cd $(dir $@) && pdflatex-dev $(notdir $<); done
samples/sample-sigconf-biblatex.pdf: samples/sample-sigconf-biblatex.tex $(SAMPLEBIBLATEXFILES)
cd $(dir $@) && pdflatex-dev $(notdir $<)
- cd $(dir $@) && biber $(notdir $(basename $<))
cd $(dir $@) && pdflatex-dev $(notdir $<)
cd $(dir $@) && pdflatex-dev $(notdir $<)
while ( grep -q '^LaTeX Warning: Label(s) may have changed' $(basename $<).log) \
do cd $(dir $@) && pdflatex-dev $(notdir $<); done
samples/sample-acmsmall-biblatex.pdf: samples/sample-acmsmall-biblatex.tex $(SAMPLEBIBLATEXFILES)
cd $(dir $@) && pdflatex-dev $(notdir $<)
- cd $(dir $@) && biber $(notdir $(basename $<))
cd $(dir $@) && pdflatex-dev $(notdir $<)
cd $(dir $@) && pdflatex-dev $(notdir $<)
while ( grep -q '^LaTeX Warning: Label(s) may have changed' $(basename $<).log) \
do cd $(dir $@) && pdflatex-dev $(notdir $<); done
samples/sample-xelatex.pdf: samples/sample-xelatex.tex samples/$(PACKAGE).cls samples/ACM-Reference-Format.bst
cd $(dir $@) && xelatex-dev $(notdir $<)
- cd $(dir $@) && bibtex $(notdir $(basename $<))
cd $(dir $@) && xelatex-dev $(notdir $<)
cd $(dir $@) && xelatex-dev $(notdir $<)
while ( grep -q '^LaTeX Warning: Label(s) may have changed' $(basename $<).log) \
do cd $(dir $@) && xelatex-dev $(notdir $<); done
samples/sample-lualatex.pdf: samples/sample-lualatex.tex samples/$(PACKAGE).cls samples/ACM-Reference-Format.bst
cd $(dir $@) && lualatex-dev $(notdir $<)
- cd $(dir $@) && bibtex $(notdir $(basename $<))
cd $(dir $@) && lualatex-dev $(notdir $<)
cd $(dir $@) && lualatex-dev $(notdir $<)
while ( grep -q '^LaTeX Warning: Label(s) may have changed' $(basename $<).log) \
do cd $(dir $@) && lualatex-dev $(notdir $<); done
samples/sample-acmcp.pdf: samples/acm-jdslogo.png
.PRECIOUS: $(PACKAGE).cfg $(PACKAGE).cls
docclean:
$(RM) *.log *.aux \
*.cfg *.glo *.idx *.toc \
*.ilg *.ind *.out *.lof \
*.lot *.bbl *.blg *.gls *.cut *.hd \
*.dvi *.ps *.thm *.tgz *.zip *.rpi \
samples/$(PACKAGE).cls samples/ACM-Reference-Format.bst \
samples/*.log samples/*.aux samples/*.out \
samples/*.bbl samples/*.blg samples/*.cut \
samples/acm-jdslogo.png \
samples/*.run.xml samples/*.bcf $(SAMPLEBIBLATEXFILES)
clean: docclean
$(RM) $(PACKAGE).cls \
samples/*.tex
distclean: clean
$(RM) *.pdf samples/sample-*.pdf
#
# Archive for the distribution. Includes typeset documentation
#
archive: all clean
COPYFILE_DISABLE=1 tar -C .. -czvf ../$(PACKAGE).tgz --exclude '*~' --exclude '*.tgz' --exclude '*.zip' --exclude CVS --exclude '.git*' $(PACKAGE); mv ../$(PACKAGE).tgz .
zip: all clean
zip -r $(PACKAGE).zip * -x '*~' -x '*.tgz' -x '*.zip' -x CVS -x 'CVS/*'
# distros
distros: all docclean
zip -r acm-distro.zip \
acmart.pdf acmguide.pdf samples *.cls ACM-Reference-Format.* \
--exclude samples/sample-acmengage*
zip -r acmengage-distro.zip samples/sample-acmengage* \
samples/*.bib \
acmart.pdf acmguide.pdf *.cls ACM-Reference-Format.*
.PHONY: all ALLSAMPLES docclean clean distclean archive zip

View File

@ -1,345 +0,0 @@
This package provides a class for typesetting publications of the
Association for Computing Machinery.
Your TeX distribution probably includes the latest released version of
this package. If you decide to install it yourself, please see the
Installation section of the User's Guide.
Please note that the version on Github is a development (or
experimental) version: please download it for testing new features.
The production version is the one on CTAN and ACM sites.
Changes
Version 1.90 Journal ISSN updated
Version 1.89a Added version info to .bst
Version 1.89 Bug fixes
Redesign of ACMCP
New positioning of badges
New journals: PACMMOD, TOPML
Version 1.88 New ISSNs
Documentation updates
New journal: PACMNET
Version 1.87 CC license is allowed for non-acm documents and ACM Engage
documents only
New format acmcp for the cover page
New journals: JATS, ACMJCSS, TORS
Bug fixes
Version 1.86. Empty country in affiliation now produces an error
Bug fixes
New samples for acmengage
Version 1.85. Bug fixes
Added support for Creative Commons licenses (requires
doclicense images)
New journals
New format acmengage for ACM Engage CSEdu course materials
Version 1.84 Support for BibLaTeX rewritten (thanks to
Roberto Di Cosmo and Kartik Singhal)
Corrected German translation (thanks to Dirk Beyer)
New journals
Version 1.83 Support for multilanguage papers
ISSN changes for some journals
Version 1.82 Bug fixes.
New command \anon for anonymization of short strings.
Documentation update.
Version 1.81 Bug fixes
New bib field distinctURL to print URL even if doi is present.
Reworded samples
Version 1.80 New journals: DLT, FAC
Version 1.79 Fixed pages with index
(https://github.com/borisveytsman/acmart/issues/440)
Updated information for TAP, TCPS, TEAC
Version 1.78 Documentation update.
Magic texcount comments for samples.
Title page now is split if there are too many authors
Bug fixes.
Version 1.77 Changed the way to typeset multiple affiliations (Christoph Sommer)
Version 1.76 Added many journal abbreviations to the bst.
New experimental option: pbalance
ORCID linking code
Version 1.75 Omitted \country now produces error.
Added \AtBeginMaketitle
Version 1.74 Bug fixes. A regression introduced in the font changes
is reverted.
Version 1.73 Bug fixes
The elements institution, city and country are now obligatory
for affiliations. The absence of them produces a warning
Version 1.72 Bug fixes. Better handling of metadata.
Version 1.71 Bug fixes
Formats sigchi and sigchi-a are retired
Bibliography formatting changes for @inproceedings entries
having both series and volume
LuaLaTeX now uses the same OTF fonts as XeLaTeX
Version 1.70 Title change for ACM/IMS Transactions on Data Science
Bug fixes for bibliography
Version 1.69 Bug fixes
Compatibility with LaTeX 2020-02-02 release
Version 1.68 Bug fixes
BST now recognizes words `Paper' or 'Article' in
eid or articleno
Version 1.67 Urgent bug fixes:
BibTeX style bug fixed (Michael D. Adams)
Sigplan special section bugfix
Version 1.66 Bug fixes
BibTeX change: location is now a synonym for city (Feras Saad)
ACM reference format is now mandatory for papers over one page.
CCS concepts and keywords are now mandatory for
papers over two pages.
Authors' addresses are mandatory for journal articles.
Version 1.65 Bug fixes
New journal: DGOV
DTRAP and HEALTH are now using acmlarge format
Version 1.64 Produce error if abstract is entered after maketitle
(previously abstract was silently dropped)
Bug fixes for line numbering
Version 1.63a Moved TQUANT to TQC
Version 1.63 New journals: TQUANT, FACMP
Version 1.62 Documentation update
New journal: TELO
Bug fixes
Version 1.61 Bug fixes
New bibtex types for artifacts
Version 1.60 New option: urlbreakonhyphens (thanks to Peter Kemp)
Smaller header size for acmsmall
Version 1.59 Now a journal format can be used for conference proceedings
All samples are now generated from the same .dtx file
Bug fixes
Version 1.58 Suppressed spurious warnings.
New journal: HEALTH.
TDSCI is renamed to TDS.
Version 1.57 Change of \baselinestretch now produces an error
Booktabs is now always loaded
Added option `balance' to balance last page in two-column mode
E-mail is no longer split in addresses
New samples (Stephen Spencer)
Version 1.56 Bug fixes
Added \flushbottom to two column formats (Philip Quinn)
The final punctuation for the list of concepts
is now a period instead of a semicolon (Philip Quinn)
New command \Description to describe images for visually
impaired users.
Version 1.55 Bug fixes
Font changes for SIGCHI table captions
Version 1.54 New option: 'nonacm' (Gabriel Scherer)
Deleted indent for subsubsection (suggested by Ross Moore)
Suppressed some obscurious warning in BibTeX processing
Suppressed hyperrerf warnings (Paolo G. Giarrusso)
New code for sections to help with accessibility patches
(Ross Moore)
Submission id, if present, is printed in anon mode
Bug fixes
Version 1.53 New journals: PACMCGIT, TIOT, TDSCI
Version 1.52 Another rewording of licenses
Version 1.51 Journal footers now use abbreviated journal titles.
Corrected the bug with acmPrice.
Do not show price when copyright is set to iw3c2w3 and iw3c2w3g.
The package now is compatible with polyglossia (Joachim Breitner).
Slightly reworded copyright statements.
Version 1.50 Changes in iw3c2w3 and iw3c2w3g
Version 1.49 New jorunal: DTRAP
Version 1.48 Bug fixes
Review mode now switches on folios
Code prettying (Michael D. Adams)
Bibliography changes: @MISC entries no longer have a
separate date
Sigch-a sample bibliography renamed
Bib code cleanup (Zack Weinberg)
Acmart and version info are added to pdfcreator tag
\citeyear no longer produces parenthetical year
Added initial support for Biblatex (Daniel Thomas)
Added support for IW3C2 conferences
Version 1.47 New journal: THRI
Version 1.46 Bug fixes for bibliography: label width is now calculated
correctly.
All PACM now use screen option. This requires etoolbox.
Added subtitle to ACM reference format.
Now acmart is compatible with fontspec.
\thanks is now obsolete. The addresses are automatically
added to the journal version; this can be overriden with
\authorsaddresses command.
Deleted the rule at the end of frontmatter for all formats.
Deleted new line before doi in the reference format.
Reintegrated theorem code into acmart.dtx (Matthew Fluet)
Version 1.45 Workaround for a Libertine bug. Thanks to LianTze Lim
from Overleaf
Version 1.44 Bug fixes.
Empty DOI and ISBN suppress printing DOI or ISBN lines
Separated theorem code into acmthm.sty, loaded by default.
Article number can be set for proceedings.
New commands: \acmBooktile, \editor.
Reference citation format updated.
Version 1.43 Bug fixes
Version 1.42 Deleted ACM badges
Bug fixes
Version 1.41 Rearranged bib files
Added new badges
Version 1.40 Bibliography changes
Added processing of one-compoment ccsdesc nodes
Bug fixes.
Made the height a multiple of \baselineskip + \topskip
Added cleveref
We no longer print street address in SIGs
Version 1.39 Added \authornotemark commmand
Version 1.38 Increase default font size for SIGPLAN
Version 1.37 Reduce list indentation (Matthew Fluet)
Version 1.36 Bug fixes
Moved PACMPL to acmlarge format
New journal: PACMHCI
Added the possibility to adjust number of author
boxes per row in conference formats
Version 1.35 Author-year bib style now uses square brackets.
Changed defaults for TOG sample
Price is suppressed for usgov and rightsretained modes.
Bugs fixed
Version 1.34 Deleted DOI from doi numbers
Changed bibstrip formatting
The command \terms is now obsolete
The rulers in review mode now have continuous numbering
Version 1.33 New option `timestamp' (Michael D. Adams)
New option `authordraft'
Documentation updates
Bug fixes
We now use Type 1 versions of Libertine fonts even with XeTeX.
New hook acmart-preload-hook.tex (wizards only!)
Added new options `obeypunctuation' for \affiliation command
Added SubmissionID
Added right line count ruler for two-column formats
Added workaround for Adobe Acrobat bugs in selection
Added eid field to the bibliography
Version 1.32 New DOI formatting.
Format siggraph is now obsolete, and sigconf
is used instead.
New proceedings title: POMACS.
Version 1.31 Changed default year and month to the current ones
(thanks to Matteo Riondato)
Table of contents now works
Marginalia now work in all formats
New command \additionalaffiliation
Documentation changes
Version 1.30 Bibtex style now recognizes https:// in doi.
Added \frenchspacing.
\department now has an optional hierarchy level.
Switched to T1 encoding
Updated IMWUT and PACMPL
Version 1.29 Documentation changes. Head height increased from 12pt to 13pt.
Removed spurious indent at start of abstract.
Improved kerning in CCS description list.
Version 1.28 Bug fixes: natbib=false now behaves correctly.
Version 1.27 Bug fixes
Version 1.26 Bug fixes
Version 1.25 Updated PACMPL journal option.
Version 1.24 Added IMWUT journal option.
Version 1.23 Added PACM PL journal option.
Version 1.22 Bibliography changes for Aptara backend; should be
invisible for the users.
Version 1.21 Bibliography changes: added arXiv, some cleanup
Version 1.20 Bug fixes, documentation updates
Version 1.19 Include 'Abstract', 'Acknowledgements', and 'References'
in PDF bookmarks.
Version 1.18 Natbib is now the default for all versions. A unified bib
file is used for all styles. Better treatment
of multiple affiliations.
Version 1.17 Formatting changes for margins and lists. Bug fixes.
Version 1.16 Formatting changes for headers and footers.
Version 1.15 New structured affiliation command.
New commands for acknowledgements.
Version 1.14 Warn about undefined citation styles; move definitions
of acmauthoryear and acmnumeric citation styles before
use.
Version 1.13 Formatting changes: headers, folios etc.
Bibliography changes.
Version 1.12 Bug fixes and documentation updates.
Footnotes rearranged.
Option natbib is now mostly superfluous: the class
makes a guess based on the format chosen.
Version 1.11 Customization of ACM theorem styles and proof
environment (Matthew Fluet).
Version 1.10 Bug fixes
Version 1.09 SIGPLAN: revert caption rules (Matthew Fluet)
Version 1.08 SIGPLAN reformatting (Matthew Fluet); bug fixes

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@ -1,95 +0,0 @@
@Misc{TeXFAQ,
title = {{UK} List of {\TeX} Frequently Asked Questions},
author = {{UK \TeX{} Users Group}},
year = 2019,
howpublished = {\url{https://texfaq.org}}
}
@Manual{Downes04:amsart,
title = {The \textsf{amsart}, \textsf{amsproc}, and
\textsf{amsbook} document~classes},
author = {Michael Downes and Barbara Beeton},
organization = {American Mathematical Society},
year = 2004,
month = aug,
note = {\url{http://www.ctan.org/pkg/amslatex}}
}
@Manual{Fiorio15,
title = {{a}lgorithm2e.sty---package for algorithms},
author = {Cristophe Fiorio},
year = 2015,
month = oct,
note = {\url{http://www.ctan.org/pkg/algorithm2e}}
}
@Manual{Brito09,
title = {The algorithms bundle},
author = {Rog\'erio Brito},
year = 2009,
month = aug,
note = {\url{http://www.ctan.org/pkg/algorithms}}
}
@Manual{Heinz15,
title = {The Listings Package},
author = {Carsten Heinz and Brooks Moses and Jobst Hoffmann},
year = 2015,
month = jun,
note = {\url{http://www.ctan.org/pkg/listings}}
}
@Manual{Fear05,
title = {Publication quality tables in {\LaTeX}},
author = {Simon Fear},
year = 2005,
month = apr,
note = {\url{http://www.ctan.org/pkg/booktabs}}
}
@Manual{ACMIdentityStandards,
title = {{ACM} Visual Identity Standards},
organization = {Association for Computing Machinery},
year = 2007,
note = {\url{http://identitystandards.acm.org}}
}
@Manual{Sommerfeldt13:Subcaption,
title = {The subcaption package},
author = {Axel Sommerfeldt},
year = 2013,
month = apr,
note = {\url{http://www.ctan.org/pkg/subcaption}}
}
@Manual{Nomencl,
title = {A package to create a nomenclature},
author = {Boris Veytsman and Bern Schandl and Lee Netherton
and C. V. Radhakrishnan},
year = 2005,
month = sep,
note = {\url{http://www.ctan.org/pkg/nomencl}}
}
@Manual{Talbot16:Glossaries,
title = {User Manual for glossaries.sty v4.44},
author = {Nicola L. C. Talbot},
year = 2019,
month = dec,
note = {\url{http://www.ctan.org/pkg/glossaries}}
}
@Manual{Carlisle04:Textcase,
title = {The \textsl{textcase} package},
author = {David Carlisle},
month = oct,
year = 2004,
note = {\url{http://www.ctan.org/pkg/textcase}}
}
@Manual{Braams22:Babel,
title = {Babel},
author = {Johannes L. Braams and Javier Bezos},
year = 2022,
note = {\url{http://www.ctan.org/pkg/babel}}}

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +0,0 @@
%
% Doctrip file for acmart
% This file is in public domain
% $Id: acmart.ins,v 1.1 2015/11/23 22:42:55 boris Exp $
%
\def\batchfile{acmart.ins}
\input docstrip
\keepsilent
\showprogress
\askforoverwritefalse
\generate{%
\file{acmart.cls}{\from{acmart.dtx}{class}}
}
\obeyspaces
\Msg{*****************************************************}%
\Msg{* Congratulations! You successfully generated the *}%
\Msg{* acmart package. *}%
\Msg{* *}%
\Msg{* Please move the file acmart.cls to where LaTeX *}%
\Msg{* files are stored in your system. The manual is *}%
\Msg{* acmart.pdf. *}%
\Msg{* *}%
\Msg{* The package is released under LPPL *}%
\Msg{* *}%
\Msg{* Happy TeXing! *}%
\Msg{*****************************************************}%

View File

@ -1,900 +0,0 @@
\ProvidesFile{acmauthoryear.bbx}[2022-02-14 v0.1 biblatex bibliography style]
% Inherit a default style
\RequireBibliographyStyle{authoryear-comp}
%%% New command definitions from trad-standard.bbx
\newcommand*{\newcommaunit}{\@ifstar\newcommaunitStar\newcommaunitNoStar}
\newcommand*{\newcommaunitStar}{\setunit*{\addcomma\space}}
\newcommand*{\newcommaunitNoStar}{\setunit{\addcomma\space}}
%%% Forward compatibility for date+extradate
\ifcsundef{ifbibmacroundef}{
\ifcsundef{abx@macro@date+extradate}{ %%% For really really old biblatex that miss \ifbibmacroundef
\blx@warning{bibmacro 'date+extradate' is missing.\MessageBreak
Please consider updating your version of biblatex.\MessageBreak
Using 'date+extrayear' instead}%
\providebibmacro*{date+extradate}{\usebibmacro{date+extrayear}}
}{}
}
{
\ifbibmacroundef{date+extradate}{
\blx@warning{bibmacro 'date+extradate' is missing.\MessageBreak
Please consider updating your version of biblatex.\MessageBreak
Using 'date+extrayear' instead}%
\providebibmacro*{date+extradate}{\usebibmacro{date+extrayear}}
}{}
}
%%% Localisation strings for ACM
\DefineBibliographyStrings{american}{%
mathesis = {Master's thesis},
phdthesis = {Ph\adddot{}D\adddotspace Dissertation},
editor = {(Ed\adddot)},
editors = {(Eds\adddot)},
edition = {ed\adddot},
}
%%% Formatting for fields
%\DeclareFieldFormat
% [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
% {title}{#1}
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{numpages}{#1 pages}
\DeclareFieldFormat{number}{#1}
\DeclareFieldFormat{articleno}{Article #1}
\DeclareFieldFormat{key}{#1}
\DeclareFieldFormat{urldate}{Retrieved\space{}#1\space{}from}
\DeclareFieldFormat{lastaccessed}{Retrieved\space{}#1\space{}from}
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{edition}{%
\printtext[parens]{\ifinteger{#1}
{\mkbibordedition{#1}~\bibstring{edition}}
{#1\isdot~\bibstring{edition}}}}
% Handle urls field containing 'and' separated list of URLs
% https://github.com/plk/biblatex/issues/229
\DeclareListFormat{urls}{%
\url{#1}%
\ifthenelse{\value{listcount}<\value{liststop}}
{\addcomma\space}
{}}
\renewbibmacro*{url}{\iffieldundef{url}{\printlist{urls}}{\printfield{url}}}
%%% Bibmacro definitions
\renewbibmacro*{translator+others}{%
\ifboolexpr{
test \ifusetranslator
and
not test {\ifnameundef{translator}}
}
{\printnames{translator}%
\setunit{\addcomma\space}%
\usebibmacro{translator+othersstrg}%
\clearname{translator}}
{\printfield{key}}}
\newbibmacro*{year}{%
\iffieldundef{year}%
{\printtext{[n.\ d.]}}%
{\printfield{year}}%
}
\renewbibmacro*{date}{\printtext[parens]{\printdate}}
\renewbibmacro*{url+urldate}{\iffieldundef{urlyear}
{\iffieldundef{lastaccessed}
{}
{\printfield{lastaccessed}%
\setunit*{\addspace}}%
}
{\usebibmacro{urldate}%
\setunit*{\addspace}}%
\usebibmacro{url}%
}
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addcomma\space}%
\iffieldundef{series}
{}
{\newunit%
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume+number+date+pages+eid}%
\newcommaunit%
% \setunit{\addspace}%
\usebibmacro{issue-issue}%
\setunit*{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
\newbibmacro*{volume+number+date+pages+eid}{%
\printfield{volume}%
\setunit*{\addcomma\space}%
\printfield{number}%
\setunit*{\addcomma\space}%
\printfield{articleno}
\setunit{\addcomma\space}
\usebibmacro{date-ifmonth}
\setunit{\addcomma\space}%
\iffieldundef{pages}%
{\printfield{numpages}}%
{\printfield{pages}}%
\newcommaunit%
\printfield{eid}}%
\renewbibmacro*{chapter+pages}{%
\printfield{chapter}%
\setunit{\bibpagespunct}%
\iffieldundef{pages}%
{\printfield{numpages}}%
{\printfield{pages}}%
\newunit}
\renewbibmacro*{editor+others}{%
\ifboolexpr{
test \ifuseeditor
and
not test {\ifnameundef{editor}}
}
{\printnames{editor}%
\setunit{\addcomma\space}%
\usebibmacro{editor+othersstrg}%
\clearname{editor}}
{\iflistundef{organization}{}{\printlist{organization}}}
\usebibmacro{date+extradate}
}
\newbibmacro*{issue-issue}{%
\iffieldundef{issue}%
{}%
{\printfield{issue}%
\setunit*{\addcomma\space}%
\usebibmacro{date-ifmonth}%
}%
\newunit}
\newbibmacro*{maintitle+booktitle+series+number}{%
\iffieldundef{maintitle}
{}
{\usebibmacro{maintitle}%
\newunit\newblock
\iffieldundef{volume}
{}
{\printfield{volume}%
\printfield{part}%
\setunit{\addcolon\space}}}%
\usebibmacro{booktitle}%
\setunit*{\addspace}
\printfield[parens]{series}%
\setunit*{\addspace}%
\printfield{number}%
\setunit*{\addcomma\space}%
\printfield{articleno}
\newunit
}
\renewbibmacro*{booktitle}{%
\ifboolexpr{
test {\iffieldundef{booktitle}}
and
test {\iffieldundef{booksubtitle}}
}
{}
{\printtext[booktitle]{%
\printfield[titlecase]{booktitle}%
\iffieldundef{booksubtitle}{}{
\setunit{\subtitlepunct}%
\printfield[titlecase]{booksubtitle}}%
}%
}%
\printfield{booktitleaddon}}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\setunit*{\addcomma\space}%
\printfield{number}%
\setunit*{\addcomma\space}%
\printfield{articleno}
\setunit{\addcomma\space}%
\printfield{eid}}
\renewbibmacro*{publisher+location+date}{%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}%
\usebibmacro{date-ifmonth}%
\newunit}
\newbibmacro{date-ifmonth}{%
\iffieldundef{month}{}{%
\usebibmacro{date}
}%
}
\renewbibmacro*{institution+location+date}{%
\printlist{school}%
\setunit*{\addcomma\space}%
\printlist{institution}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}%
\usebibmacro{date-ifmonth}%
\newunit}
\renewbibmacro*{periodical}{%
\iffieldundef{title}
{}
{\printtext[title]{%
\printfield[titlecase]{title}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}}%
\newunit%
\usebibmacro{journal}}
\renewbibmacro*{issue+date}{%
\iffieldundef{issue}
{\usebibmacro{date}}
{\printfield{issue}%
\setunit*{\addspace}%
\usebibmacro{date}}%
\newunit}
\renewbibmacro*{title+issuetitle}{%
\usebibmacro{periodical}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\printfield{volume}%
\setunit*{\addcomma\space}%
\printfield{number}%
\setunit*{\addcomma\space}%
\printfield{articleno}
\setunit{\addcomma\space}%
\printfield{eid}%
\setunit{\addspace}%
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
\renewbibmacro*{doi+eprint+url}{%
\iftoggle{bbx:url}
{\iffieldundef{doi}{
\usebibmacro{url+urldate}
}{\iffieldundef{distinctURL}
{}
{\usebibmacro{url+urldate}}
}
}%
\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
\iftoggle{bbx:doi}
{\printfield{doi}}
{}}
%%% Definitions for drivers (alphabetical)
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock%
\usebibmacro{title}%
\newunit%
\printlist{language}%
\newunit\newblock%
\usebibmacro{byauthor}%
\newunit\newblock%
\usebibmacro{bytranslator+others}%
\newunit\newblock%
\printfield{version}%
\newunit\newblock%
\usebibmacro{journal+issuetitle}%
\newunit%
\usebibmacro{byeditor+others}%
\newunit%
\printfield{note}%
\newunit\newblock%
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock%
\usebibmacro{doi+eprint+url}%
\newunit\newblock%
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock%
\usebibmacro{related}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+title}%
\newunit%
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\usebibmacro{series+number}%
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\newunit\newblock
\printfield{volumes}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{inbook}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\iffieldundef{author}%
{\usebibmacro{byeditor+others}}%
{\usebibmacro{author/translator+others}}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
% \usebibmacro{in:}%
\usebibmacro{bybookauthor}%
\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\iffieldundef{author}{}%if undef then we already printed editor
{\usebibmacro{byeditor+others}}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{incollection}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{in:}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{inproceedings}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{in:}%
\usebibmacro{maintitle+booktitle+series+number}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{manual}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor}%
\newunit\newblock
\printfield{edition}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{type}%
\newunit
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{misc}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{howpublished}%
\newunit\newblock
\printfield{type}%
\newunit
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\usebibmacro{organization+location+date}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{online}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit\newblock
\usebibmacro{date-ifmonth}%
\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
\usebibmacro{url+urldate}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareFieldFormat[patent]{number}{Patent No.~#1}
\DeclareBibliographyDriver{patent}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{date}%
\newunit\newblock
\printfield{type}%
\setunit*{\addspace}%
\printfield{number}%
\iflistundef{location}
{}
{\setunit*{\addspace}%
\printtext[parens]{%
\printlist[][-\value{listtotal}]{location}}}%
\newunit\newblock
\usebibmacro{byholder}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{periodical}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{editor}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title+issuetitle}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byeditor}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{issn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{report}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\printfield{type}%
\setunit*{\addspace}%
\printfield{number}%
\newunit\newblock
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\usebibmacro{institution+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isrn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{thesis}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\printfield{type}%
\newunit
\usebibmacro{institution+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
%
% Include support for software entries
%
\blx@inputonce{software.bbx}{biblatex style for software}{}{}{}{}
%
% Handle ACM specific ArtifactSoftware entry exactly as the software entry (a soft alias will not work)
%
\DeclareStyleSourcemap{
\maps[datatype=bibtex]{
\map{
\step[typesource=artifactsoftware,typetarget=software]
\step[typesource=artifactdataset,typetarget=dataset]
}
}
}
%%% Compatibility with ACM bibtex formatting
%
% Show given name first in the reference list
%
\DeclareNameAlias{sortname}{given-family}
%
% Produce a bibliography with small font size
%
\renewcommand*{\bibfont}{\bibliofont\footnotesize}
%
% Remove parentheses from date+extradate
%
\RequirePackage{xpatch}
\xpatchbibmacro{date+extradate}{%
\printtext[parens]%
}{%
\newblock\setunit*{.\space}%
\printtext%
}{}{}
%%% Set option values for ACM style
\ExecuteBibliographyOptions{
dashed=false, % Do not use dashes for bibliography items with the same set of authors
labeldate=year,
abbreviate=true,
dateabbrev=true,
isbn=true,
doi=true,
urldate=comp,
url=true,
maxbibnames=9,
maxcitenames=2,
backref=false,
sorting=nty,
halid=true,
swhid=true,
swlabels=true,
vcs=true,
license=false,
language=american
}

View File

@ -1,219 +0,0 @@
\ProvidesFile{acmauthoryear.cbx}[2022-02-14 v0.1]
\RequireCitationStyle{authoryear-comp}
\RequirePackage{xpatch}
%
% Hyperlink citations like acmart natbib implementation
%
% From https://tex.stackexchange.com/a/27615/133551
% Combine label and labelyear links
\xpatchbibmacro{cite}
{\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}%
\usebibmacro{cite:labeldate+extradate}}
{\printtext[bibhyperref]{%
\DeclareFieldAlias{bibhyperref}{default}%
\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}%
\usebibmacro{cite:labeldate+extradate}}}
{}
{\PackageWarning{biblatex-patch}
{Failed to patch cite bibmacro}}
% Include labelname in labelyear link
\xpatchbibmacro{cite}
{\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}%
\usebibmacro{cite:labeldate+extradate}}
{\printtext[bibhyperref]{%
\DeclareFieldAlias{bibhyperref}{default}%
\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}%
\usebibmacro{cite:labeldate+extradate}}}
{}
{\PackageWarning{biblatex-patch}
{Failed to patch cite bibmacro}}
\renewbibmacro*{textcite}{%
\iffieldequals{namehash}{\cbx@lasthash}
{\iffieldundef{shorthand}
{\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
\(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
{\setunit{\addcomma}%
\usebibmacro{cite:extradate}}
{\setunit{\compcitedelim}%
\usebibmacro{cite:labeldate+extradate}%
\savefield{labelyear}{\cbx@lastyear}}}
{\setunit{\compcitedelim}%
\usebibmacro{cite:shorthand}%
\global\undef\cbx@lastyear}}
{\ifnameundef{labelname}
{\iffieldundef{shorthand}
{\usebibmacro{cite:label}%
\setunit{%
\global\booltrue{cbx:parens}%
\printdelim{nonameyeardelim}\bibopenbracket}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\usebibmacro{cite:labeldate+extradate}}
{\usebibmacro{cite:shorthand}}}
{\printnames{labelname}%
\setunit{%
\global\booltrue{cbx:parens}%
\printdelim{nameyeardelim}\bibopenbracket}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\iffieldundef{shorthand}
{\iffieldundef{labelyear}
{\usebibmacro{cite:label}}
{\usebibmacro{cite:labeldate+extradate}}%
\savefield{labelyear}{\cbx@lastyear}}
{\usebibmacro{cite:shorthand}%
\global\undef\cbx@lastyear}}%
\stepcounter{textcitecount}%
\savefield{namehash}{\cbx@lasthash}}%
\setunit{%
\ifbool{cbx:parens}
{\bibclosebracket\global\boolfalse{cbx:parens}}
{}%
\textcitedelim}}
\xpatchbibmacro{textcite}
{\printnames{labelname}}
{\printtext[bibhyperref]{\printnames{labelname}}}
{}
{\PackageWarning{biblatex-patch}
{Failed to patch textcite bibmacro}}
\renewbibmacro*{textcite:postnote}{%
\usebibmacro{postnote}%
\ifthenelse{\value{multicitecount}=\value{multicitetotal}}
{\setunit{}%
\printtext{%
\ifbool{cbx:parens}
{\bibclosebracket\global\boolfalse{cbx:parens}}
{}}}
{\setunit{%
\ifbool{cbx:parens}
{\bibclosebracket\global\boolfalse{cbx:parens}}
{}%
\textcitedelim}}}
% NEW
\newbibmacro*{citeauthor}{%
\ifnameundef{labelname}
{\iffieldundef{shorthand}
{\printtext[bibhyperref]{%
\usebibmacro{cite:label}}%
\setunit{%
\global\booltrue{cbx:parens}%
\printdelim{nonameyeardelim}\bibopenbracket}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\printtext[bibhyperref]{\usebibmacro{cite:labeldate+extradate}}}
{\printtext[bibhyperref]{\usebibmacro{cite:shorthand}}}}
\printtext[bibhyperref]{\printnames{labelname}}}
%
% Put brackets around citations
%
\DeclareCiteCommand{\cite}[\mkbibbrackets]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{}
{\usebibmacro{postnote}}
\DeclareCiteCommand*{\cite}[\mkbibbrackets]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{citeyear}}
{}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\parencite}[\mkbibbrackets]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{}
{\usebibmacro{postnote}}
\DeclareCiteCommand*{\parencite}[\mkbibbrackets]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{citeyear}}
{}
{\usebibmacro{postnote}}
\DeclareMultiCiteCommand{\parencites}[\mkbibbrackets]{\parencite}
{\setunit{\multicitedelim}}
\DeclareCiteCommand{\footcite}[\mkbibfootnote]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\footcitetext}[\mkbibfootnotetext]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\smartcite}[\iffootnote\mkbibbrackets\mkbibfootnote]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{}
{\usebibmacro{postnote}}
\DeclareMultiCiteCommand{\smartcites}[\iffootnote\mkbibbrackets\mkbibfootnote]
{\smartcite}{\setunit{\multicitedelim}}
\DeclareCiteCommand{\citeauthor}
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{citeauthor}}
{}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\citeyear}
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{citeyear}}
{}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\citeyearpar}[\mkbibbrackets]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{citeyear}}
{}
{\usebibmacro{postnote}}
%
% Provide aliases for natbib-compatible commands
%
\newcommand*{\citep}{\parencite}
\newcommand*{\citet}{\textcite}
% add others here
\endinput

View File

@ -1,33 +0,0 @@
% Teach biblatex about numpages field
\DeclareDatamodelFields[type=field, datatype=literal]{numpages}
\DeclareDatamodelEntryfields{numpages}
% Teach biblatex about articleno field
\DeclareDatamodelFields[type=field, datatype=literal]{articleno}
\DeclareDatamodelEntryfields{articleno}
% Teach biblatex about urls field
\DeclareDatamodelFields[type=list, datatype=uri]{urls}
\DeclareDatamodelEntryfields{urls}
% Teach biblatex about school field
\DeclareDatamodelFields[type=list, datatype=literal]{school}
\DeclareDatamodelEntryfields[thesis]{school}
\DeclareDatamodelFields[type=field, datatype=literal]{key}
\DeclareDatamodelEntryfields{key}
% Teach biblatex about lastaccessed field
\DeclareDatamodelFields[type=field,datatype=literal]{lastaccessed}
\DeclareDatamodelEntryfields{lastaccessed}
% Teach biblatex about distincturl field
\DeclareDatamodelFields[type=field, datatype=literal]{distinctURL}
\DeclareDatamodelEntryfields{distinctURL}
%
% include software data model from biblatex-software
%
\blx@inputonce{software.dbx}{biblatex data model extension for software}{}{}{}{}

View File

@ -1,885 +0,0 @@
\ProvidesFile{acmnumeric.bbx}[2017-09-27 v0.1 biblatex bibliography style]
% Inherit a default style
\RequireBibliographyStyle{trad-plain}
%%% Localisation strings for ACM
\DefineBibliographyStrings{american}{%
mathesis = {Master's thesis},
phdthesis = {Ph\adddot{}D\adddotspace Dissertation},
editor = {(Ed\adddot)},
editors = {(Eds\adddot)},
edition = {ed\adddot},
}
%%% Formatting for fields
%\DeclareFieldFormat
% [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
% {title}{#1}
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{numpages}{#1 pages}
\DeclareFieldFormat{number}{#1}
\DeclareFieldFormat{articleno}{Article #1}
\DeclareFieldFormat{key}{#1}
\DeclareFieldFormat{urldate}{Retrieved\space{}#1\space{}from}
\DeclareFieldFormat{lastaccessed}{Retrieved\space{}#1\space{}from}
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{edition}{%
\printtext[parens]{\ifinteger{#1}
{\mkbibordedition{#1}~\bibstring{edition}}
{#1\isdot~\bibstring{edition}}}}
% Handle urls field containing 'and' separated list of URLs
% https://github.com/plk/biblatex/issues/229
\DeclareListFormat{urls}{%
\url{#1}%
\ifthenelse{\value{listcount}<\value{liststop}}
{\addcomma\space}
{}}
\renewbibmacro*{url}{\iffieldundef{url}{\printlist{urls}}{\printfield{url}}}
%%% Bibmacro definitions
\renewbibmacro*{translator+others}{%
\ifboolexpr{
test \ifusetranslator
and
not test {\ifnameundef{translator}}
}
{\printnames{translator}%
\setunit{\addcomma\space}%
\usebibmacro{translator+othersstrg}%
\clearname{translator}}
{\printfield{key}}}
\newbibmacro*{year}{%
\iffieldundef{year}%
{\printtext{[n.\ d.]}}%
{\printfield{year}}%
}
\renewbibmacro*{date}{\printtext[parens]{\printdate}}
\renewbibmacro*{url+urldate}{\iffieldundef{urlyear}
{\iffieldundef{lastaccessed}
{}
{\printfield{lastaccessed}%
\setunit*{\addspace}}%
}
{\usebibmacro{urldate}%
\setunit*{\addspace}}%
\usebibmacro{url}%
}
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addcomma\space}%
\iffieldundef{series}
{}
{\newunit%
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume+number+date+pages+eid}%
\newcommaunit%
% \setunit{\addspace}%
\usebibmacro{issue-issue}%
\setunit*{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
\newbibmacro*{volume+number+date+pages+eid}{%
\printfield{volume}%
\setunit*{\addcomma\space}%
\printfield{number}%
\setunit*{\addcomma\space}%
\printfield{articleno}
\setunit{\addcomma\space}
\usebibmacro{date-ifmonth}
\setunit{\addcomma\space}%
\iffieldundef{pages}%
{\printfield{numpages}}%
{\printfield{pages}}%
\newcommaunit%
\printfield{eid}}%
\renewbibmacro*{chapter+pages}{%
\printfield{chapter}%
\setunit{\bibpagespunct}%
\iffieldundef{pages}%
{\printfield{numpages}}%
{\printfield{pages}}%
\newunit}
\renewbibmacro*{editor+others}{%
\ifboolexpr{
test \ifuseeditor
and
not test {\ifnameundef{editor}}
}
{\printnames{editor}%
\setunit{\addcomma\space}%
\usebibmacro{editor+othersstrg}%
\clearname{editor}}
{\iflistundef{organization}{}{\printlist{organization}}}}
\newbibmacro*{issue-issue}{%
\iffieldundef{issue}%
{}%
{\printfield{issue}%
\setunit*{\addcomma\space}%
\usebibmacro{date-ifmonth}%
}%
\newunit}
\newbibmacro*{maintitle+booktitle+series+number}{%
\iffieldundef{maintitle}
{}
{\usebibmacro{maintitle}%
\newunit\newblock
\iffieldundef{volume}
{}
{\printfield{volume}%
\printfield{part}%
\setunit{\addcolon\space}}}%
\usebibmacro{booktitle}%
\setunit*{\addspace}
\printfield[parens]{series}%
\setunit*{\addspace}%
\printfield{number}%
\setunit*{\addcomma\space}%
\printfield{articleno}
\newunit
}
\renewbibmacro*{booktitle}{%
\ifboolexpr{
test {\iffieldundef{booktitle}}
and
test {\iffieldundef{booksubtitle}}
}
{}
{\printtext[booktitle]{%
\printfield[titlecase]{booktitle}%
\iffieldundef{booksubtitle}{}{
\setunit{\subtitlepunct}%
\printfield[titlecase]{booksubtitle}}%
}%
}%
\printfield{booktitleaddon}}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\setunit*{\addcomma\space}%
\printfield{number}%
\setunit*{\addcomma\space}%
\printfield{articleno}
\setunit{\addcomma\space}%
\printfield{eid}}
\renewbibmacro*{publisher+location+date}{%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}%
\usebibmacro{date-ifmonth}%
\newunit}
\newbibmacro{date-ifmonth}{%
\iffieldundef{month}{}{%
\usebibmacro{date}
}%
}
\renewbibmacro*{institution+location+date}{%
\printlist{school}%
\setunit*{\addcomma\space}%
\printlist{institution}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}%
\usebibmacro{date-ifmonth}%
\newunit}
\renewbibmacro*{periodical}{%
\iffieldundef{title}
{}
{\printtext[title]{%
\printfield[titlecase]{title}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}}%
\newunit%
\usebibmacro{journal}}
\renewbibmacro*{issue+date}{%
\iffieldundef{issue}
{\usebibmacro{date}}
{\printfield{issue}%
\setunit*{\addspace}%
\usebibmacro{date}}%
\newunit}
\renewbibmacro*{title+issuetitle}{%
\usebibmacro{periodical}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\printfield{volume}%
\setunit*{\addcomma\space}%
\printfield{number}%
\setunit*{\addcomma\space}%
\printfield{articleno}
\setunit{\addcomma\space}%
\printfield{eid}%
\setunit{\addspace}%
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
\renewbibmacro*{doi+eprint+url}{%
\iftoggle{bbx:url}
{\iffieldundef{doi}{
\usebibmacro{url+urldate}
}{\iffieldundef{distinctURL}
{}
{\usebibmacro{url+urldate}}
}
}%
\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
\iftoggle{bbx:doi}
{\printfield{doi}}
{}}
%%% Definitions for drivers (alphabetical)
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock%
\usebibmacro{year}%
\newunit%
\usebibmacro{title}%
\newunit%
\printlist{language}%
\newunit\newblock%
\usebibmacro{byauthor}%
\newunit\newblock%
\usebibmacro{bytranslator+others}%
\newunit\newblock%
\printfield{version}%
\newunit\newblock%
\usebibmacro{journal+issuetitle}%
\newunit%
\usebibmacro{byeditor+others}%
\newunit%
\printfield{note}%
\newunit\newblock%
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock%
\usebibmacro{doi+eprint+url}%
\newunit\newblock%
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock%
\usebibmacro{related}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{year}%
\newunit%
\usebibmacro{maintitle+title}%
\newunit%
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\usebibmacro{series+number}%
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\newunit\newblock
\printfield{volumes}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{inbook}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\iffieldundef{author}%
{\usebibmacro{byeditor+others}}%
{\usebibmacro{author/translator+others}}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{year}
\newunit\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
% \usebibmacro{in:}%
\usebibmacro{bybookauthor}%
\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\iffieldundef{author}{}%if undef then we already printed editor
{\usebibmacro{byeditor+others}}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{incollection}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{year}
\newunit\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{in:}%
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{inproceedings}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{year}
\newunit\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{in:}%
\usebibmacro{maintitle+booktitle+series+number}%
\newunit\newblock
\usebibmacro{event+venue+date}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{manual}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{year}
\newunit\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor}%
\newunit\newblock
\printfield{edition}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{type}%
\newunit
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{misc}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{year}
\newunit\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{howpublished}%
\newunit\newblock
\printfield{type}%
\newunit
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\usebibmacro{organization+location+date}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{online}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{year}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit\newblock
\usebibmacro{date-ifmonth}%
\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
\usebibmacro{url+urldate}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareFieldFormat[patent]{number}{Patent No.~#1}
\DeclareBibliographyDriver{patent}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{year}%
\newunit
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{date}%
\newunit\newblock
\printfield{type}%
\setunit*{\addspace}%
\printfield{number}%
\iflistundef{location}
{}
{\setunit*{\addspace}%
\printtext[parens]{%
\printlist[][-\value{listtotal}]{location}}}%
\newunit\newblock
\usebibmacro{byholder}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{periodical}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{editor}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{year}
\newunit
\usebibmacro{title+issuetitle}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byeditor}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{issn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{report}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{year}
\newunit
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\printfield{type}%
\setunit*{\addspace}%
\printfield{number}%
\newunit\newblock
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\usebibmacro{institution+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isrn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareBibliographyDriver{thesis}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{year}
\newunit
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\printfield{type}%
\newunit
\usebibmacro{institution+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
%
% Include support for software entries
%
\blx@inputonce{software.bbx}{biblatex style for software}{}{}{}{}
%
% Handle ACM specific ArtifactSoftware entry exactly as the software entry (a soft alias will not work)
%
\DeclareStyleSourcemap{
\maps[datatype=bibtex]{
\map{
\step[typesource=artifactsoftware,typetarget=software]
\step[typesource=artifactdataset,typetarget=dataset]
}
}
}
%
% Show given name first in the reference list
%
\DeclareNameAlias{sortname}{given-family}
%
% Produce a bibliography with small font size
%
\renewcommand*{\bibfont}{\bibliofont\footnotesize}
%%% Set option values for ACM style
\ExecuteBibliographyOptions{
labeldate=year,
abbreviate=true,
dateabbrev=true,
isbn=true,
doi=true,
urldate=comp,
url=true,
maxbibnames=9,
maxcitenames=2,
backref=false,
sorting=nty,
halid=true,
swhid=true,
swlabels=true,
vcs=true,
license=false,
language=american
}

View File

@ -1,5 +0,0 @@
\ProvidesFile{acmnumeric.cbx}[2017-09-27 v0.1]
\RequireCitationStyle{numeric}
\endinput

View File

@ -1,86 +0,0 @@
@STRING{jan = "Jan."}
@STRING{feb = "Feb."}
@STRING{mar = "March"}
@STRING{apr = "April"}
@STRING{may = "May"}
@STRING{jun = "June"}
@STRING{jul = "July"}
@STRING{aug = "Aug."}
@STRING{sep = "Sept."}
@STRING{oct = "Oct."}
@STRING{nov = "Nov."}
@STRING{dec = "Dec."}
@STRING{cie = "ACM Computers in Entertainment"}
@STRING{csur = "ACM Computing Surveys"}
@STRING{dgov = "Digital Government: Research and Practice"}
@STRING{dtrap = "Digital Threats: Research and Practice"}
@STRING{health = "ACM Transactions on Computing for Healthcare"}
@STRING{imwut = "PACM on Interactive, Mobile, Wearable and Ubiquitous Technologies"}
@STRING{jacm = "Journal of the ACM"}
@STRING{jdiq = "ACM Journal of Data and Information Quality"}
@STRING{jea = "ACM Journal of Experimental Algorithmics"}
@STRING{jeric = "ACM Journal of Educational Resources in Computing"}
@STRING{jetc = "ACM Journal on Emerging Technologies in Computing Systems"}
@STRING{jocch = "ACM Journal on Computing and Cultural Heritage"}
@STRING{pacmcgit = "Proceedings of the ACM on Computer Graphics and Interactive Techniques"}
@STRING{pacmhci = "PACM on Human-Computer Interaction"}
@STRING{pacmpl = "PACM on Programming Languages"}
@STRING{pomacs = "PACM on Measurement and Analysis of Computing Systems"}
@STRING{taas = "ACM Transactions on Autonomous and Adaptive Systems"}
@STRING{taccess = "ACM Transactions on Accessible Computing"}
@STRING{taco = "ACM Transactions on Architecture and Code Optimization"}
@STRING{talg = "ACM Transactions on Algorithms"}
@STRING{tallip = "ACM Transactions on Asian and Low-Resource Language Information Processing"}
@STRING{tap = "ACM Transactions on Applied Perception"}
@STRING{tcps = "ACM Transactions on Cyber-Physical Systems"}
@STRING{tds = "ACM/IMS Transactions on Data Science"}
@STRING{teac = "ACM Transactions on Economics and Computation"}
@STRING{tecs = "ACM Transactions on Embedded Computing Systems"}
@STRING{telo = "ACM Transactions on Evolutionary Learning"}
@STRING{thri = "ACM Transactions on Human-Robot Interaction"}
@STRING{tiis = "ACM Transactions on Interactive Intelligent Systems"}
@STRING{tiot = "ACM Transactions on Internet of Things"}
@STRING{tissec = "ACM Transactions on Information and System Security"}
@STRING{tist = "ACM Transactions on Intelligent Systems and Technology"}
@STRING{tkdd = "ACM Transactions on Knowledge Discovery from Data"}
@STRING{tmis = "ACM Transactions on Management Information Systems"}
@STRING{toce = "ACM Transactions on Computing Education"}
@STRING{tochi = "ACM Transactions on Computer-Human Interaction"}
@STRING{tocl = "ACM Transactions on Computational Logic"}
@STRING{tocs = "ACM Transactions on Computer Systems"}
@STRING{toct = "ACM Transactions on Computation Theory"}
@STRING{todaes = "ACM Transactions on Design Automation of Electronic Systems"}
@STRING{tods = "ACM Transactions on Database Systems"}
@STRING{tog = "ACM Transactions on Graphics"}
@STRING{tois = "ACM Transactions on Information Systems"}
@STRING{toit = "ACM Transactions on Internet Technology"}
@STRING{tomacs = "ACM Transactions on Modeling and Computer Simulation"}
@STRING{tomm = "ACM Transactions on Multimedia Computing, Communications and Applications"}
@STRING{tompecs = "ACM Transactions on Modeling and Performance Evaluation of Computing Systems"}
@STRING{toms = "ACM Transactions on Mathematical Software"}
@STRING{topc = "ACM Transactions on Parallel Computing"}
@STRING{toplas = "ACM Transactions on Programming Languages and Systems"}
@STRING{tops = "ACM Transactions on Privacy and Security"}
@STRING{tos = "ACM Transactions on Storage"}
@STRING{tosem = "ACM Transactions on Software Engineering and Methodology"}
@STRING{tosn = "ACM Transactions on Sensor Networks"}
@STRING{tqc = "ACM Transactions on Quantum Computing"}
@STRING{trets = "ACM Transactions on Reconfigurable Technology and Systems"}
@STRING{tsas = "ACM Transactions on Spatial Algorithms and Systems"}
@STRING{tsc = "ACM Transactions on Social Computing"}
@STRING{tslp = "ACM Transactions on Speech and Language Processing"}
@STRING{tweb = "ACM Transactions on the Web"}
@STRING{acmcs = "ACM Computing Surveys"}
@STRING{acta = "Acta Informatica"}
@STRING{cacm = "Communications of the ACM"}
@STRING{ibmjrd = "IBM Journal of Research and Development"}
@STRING{ibmsj = "IBM Systems Journal"}
@STRING{ieeese = "IEEE Transactions on Software Engineering"}
@STRING{ieeetc = "IEEE Transactions on Computers"}
@STRING{ieeetcad = "IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
@STRING{ipl = "Information Processing Letters"}
@STRING{jcss = "Journal of Computer and System Sciences"}
@STRING{scp = "Science of Computer Programming"}
@STRING{sicomp = "SIAM Journal on Computing"}
@STRING{toois = "ACM Transactions on Office Information Systems"}
@STRING{tcs = "Theoretical Computer Science"}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@ -1,87 +0,0 @@
@Article{ai_in_transport,
AUTHOR = {Abduljabbar, Rusul and Dia, Hussein and Liyanage, Sohani and Bagloee, Saeed Asadi},
TITLE = {Applications of Artificial Intelligence in Transport: An Overview},
JOURNAL = {Sustainability},
VOLUME = {11},
YEAR = {2019},
NUMBER = {1},
ARTICLE-NUMBER = {189},
URL = {https://www.mdpi.com/2071-1050/11/1/189},
ISSN = {2071-1050},
ABSTRACT = {The rapid pace of developments in Artificial Intelligence (AI) is providing unprecedented opportunities to enhance the performance of different industries and businesses, including the transport sector. The innovations introduced by AI include highly advanced computational methods that mimic the way the human brain works. The application of AI in the transport field is aimed at overcoming the challenges of an increasing travel demand, CO2 emissions, safety concerns, and environmental degradation. In light of the availability of a huge amount of quantitative and qualitative data and AI in this digital age, addressing these concerns in a more efficient and effective fashion has become more plausible. Examples of AI methods that are finding their way to the transport field include Artificial Neural Networks (ANN), Genetic algorithms (GA), Simulated Annealing (SA), Artificial Immune system (AIS), Ant Colony Optimiser (ACO) and Bee Colony Optimization (BCO) and Fuzzy Logic Model (FLM) The successful application of AI requires a good understanding of the relationships between AI and data on one hand, and transportation system characteristics and variables on the other hand. Moreover, it is promising for transport authorities to determine the way to use these technologies to create a rapid improvement in relieving congestion, making travel time more reliable to their customers and improve the economics and productivity of their vital assets. This paper provides an overview of the AI techniques applied worldwide to address transportation problems mainly in traffic management, traffic safety, public transportation, and urban mobility. The overview concludes by addressing the challenges and limitations of AI applications in transport.},
DOI = {10.3390/su11010189}
}
@misc{ztm_dataset,
title={ZTM timetables public data},
year={2023},
url={https://www.ztm.poznan.pl/pl/dla-deweloperow/index}
}
@misc{go_csv,
title={Go CSV parser},
url={https://pkg.go.dev/encoding/csv}
}
@article{scikit_learn,
title={Scikit-learn: Machine Learning in {P}ython},
author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.
and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofer, P.
and Weiss, R. and Dubourg, V. and Vanderplas, J. and Passos, A. and
Cournapeau, D. and Brucher, M. and Perrot, M. and Duchesnay, E.},
journal={Journal of Machine Learning Research},
volume={12},
pages={2825--2830},
year={2011}
}
@misc{tensorflow2015-whitepaper,
title={ {TensorFlow}: Large-Scale Machine Learning on Heterogeneous Systems},
url={https://www.tensorflow.org/},
note={Software available from tensorflow.org},
author={
Mart\'{i}n~Abadi and
Ashish~Agarwal and
Paul~Barham and
Eugene~Brevdo and
Zhifeng~Chen and
Craig~Citro and
Greg~S.~Corrado and
Andy~Davis and
Jeffrey~Dean and
Matthieu~Devin and
Sanjay~Ghemawat and
Ian~Goodfellow and
Andrew~Harp and
Geoffrey~Irving and
Michael~Isard and
Yangqing Jia and
Rafal~Jozefowicz and
Lukasz~Kaiser and
Manjunath~Kudlur and
Josh~Levenberg and
Dandelion~Man\'{e} and
Rajat~Monga and
Sherry~Moore and
Derek~Murray and
Chris~Olah and
Mike~Schuster and
Jonathon~Shlens and
Benoit~Steiner and
Ilya~Sutskever and
Kunal~Talwar and
Paul~Tucker and
Vincent~Vanhoucke and
Vijay~Vasudevan and
Fernanda~Vi\'{e}gas and
Oriol~Vinyals and
Pete~Warden and
Martin~Wattenberg and
Martin~Wicke and
Yuan~Yu and
Xiaoqiang~Zheng},
year={2015},
}

Binary file not shown.

View File

@ -1,276 +0,0 @@
%%
%% This is file `sample-sigplan.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% samples.dtx (with options: `sigplan')
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the source file.
%%
%% Any modified versions of this file must be renamed
%% with new filenames distinct from sample-sigplan.tex.
%%
%% For distribution of the original source see the terms
%% for copying and modification in the file samples.dtx.
%%
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%%
%% Commands for TeXCount
%TC:macro \cite [option:text,text]
%TC:macro \citep [option:text,text]
%TC:macro \citet [option:text,text]
%TC:envir table 0 1
%TC:envir table* 0 1
%TC:envir tabular [ignore] word
%TC:envir displaymath 0 word
%TC:envir math 0 word
%TC:envir comment 0 0
%%
%%
%% The first command in your LaTeX source must be the \documentclass
%% command.
%%
%% For submission and review of your manuscript please change the
%% command to \documentclass[manuscript, screen, review]{acmart}.
%%
%% When submitting camera ready or to TAPS, please change the command
%% to \documentclass[sigconf]{acmart} or whichever template is required
%% for your publication.
%%
%%
\documentclass[sigplan,screen]{acmart}
%%
%% \BibTeX command to typeset BibTeX logo in the docs
\AtBeginDocument{%
\providecommand\BibTeX{{%
Bib\TeX}}}
%% Rights management information. This information is sent to you
%% when you complete the rights form. These commands have SAMPLE
%% values in them; it is your responsibility as an author to replace
%% the commands and values with those provided to you when you
%% complete the rights form.
\setcopyright{acmcopyright}
\copyrightyear{2023}
\acmYear{2023}
\acmDOI{XXXXXXX.XXXXXXX}
%% These commands are for a PROCEEDINGS abstract or paper.
\acmConference[SIGBOVIK '23]{The conference of the ACH Special Interest Group on Harry Quartet Bovik}{April 1, 2023}{Pittsburgh, Pennsylvania}
%%
%% Uncomment \acmBooktitle if the title of the proceedings is different
%% from ``Proceedings of ...''!
%%
%%\acmBooktitle{Woodstock '18: ACM Symposium on Neural Gaze Detection,
%% June 03--05, 2018, Woodstock, NY}
\acmPrice{0}
\acmISBN{978-1-4503-XXXX-X/18/06}
%%
%% Submission ID.
%% Use this when submitting an article to a sponsored event. You'll
%% receive a unique submission ID from the organizers
%% of the event, and this ID should be used as the parameter to this command.
%%\acmSubmissionID{123-A56-BU3}
%%
%% For managing citations, it is recommended to use bibliography
%% files in BibTeX format.
%%
%% You can then either use BibTeX with the ACM-Reference-Format style,
%% or BibLaTeX with the acmnumeric or acmauthoryear sytles, that include
%% support for advanced citation of software artefact from the
%% biblatex-software package, also separately available on CTAN.
%%
%% Look at the sample-*-biblatex.tex files for templates showcasing
%% the biblatex styles.
%%
%%
%% The majority of ACM publications use numbered citations and
%% references. The command \citestyle{authoryear} switches to the
%% "author year" style.
%%
%% If you are preparing content for an event
%% sponsored by ACM SIGGRAPH, you must use the "author year" style of
%% citations and references.
%% Uncommenting
%% the next command will enable that style.
%%\citestyle{acmauthoryear}
\usepackage[binary-units]{siunitx}
\usepackage{listings}
%%
%% end of the preamble, start of the body of the document source.
\begin{document}
%%
%% The "title" command has an optional parameter,
%% allowing the author to define a "short title" to be used in page headers.
\title{Superseeding Public Transport Timetables With AI}
%%
%% The "author" command and its associated commands are used to define
%% the authors and their affiliations.
%% Of note is the shared affiliation of the first two authors, and the
%% "authornote" and "authornotemark" commands
%% used to denote shared contribution to the research.
\author{Robert Bendun}
\email{robert@bendun.cc}
\affiliation{%
\institution{Adam Mickiewicz University}
\city{Poznań}
\country{Poland}
}
%%
%% The abstract is a short summary of the work to be presented in the
%% article.
\begin{abstract}
Replacing public transportation information tables using AI and mechine learning with the goal of simplyfing embdeded device implementation, reducing internet traffic and carboon footprint by replacing live tram and bus data with one predicted by model trained on historic schedule information.
\end{abstract}
%%
%% The code below is generated by the tool at http://dl.acm.org/ccs.cfm.
%% Please copy and paste the code instead of the example below.
%%
\begin{CCSXML}
<ccs2012>
<concept>
<concept_id>10003456.10003457.10003567.10003569</concept_id>
<concept_desc>Social and professional topics~Automation</concept_desc>
<concept_significance>500</concept_significance>
</concept>
</ccs2012>
\end{CCSXML}
\ccsdesc[500]{Social and professional topics~Automation}
%%
%% Keywords. The author(s) should pick words that accurately describe
%% the work being presented. Separate the keywords with commas.
\keywords{neural networks, public transport}
%% A "teaser" image appears between the author and affiliation
%% information and the body of the document, and typically spans the
%% page.
\begin{teaserfigure}
\includegraphics[width=\textwidth]{tablica-informacyjna}
\caption{Information table with nearest departures}
\Description{Enjoying the baseball game from the third-base
seats. Ichiro Suzuki preparing to bat.}
\label{fig:teaser}
\end{teaserfigure}
\received{20 February 2007}
\received[revised]{12 March 2009}
\received[accepted]{5 June 2009}
%%
%% This command processes the author and affiliation and title
%% information and builds the first part of the formatted document.
\maketitle
\section{Disclaimer}
This article is written for educational purpose. Any and all opinions and information listed in this article should be considered as not representative of me, my university and my employer. Reader discretion is advised.
\section{Introduction}
Public transportation systems are an essential part of modern city infrastructure, providing reliable and efficient transportation for millions of people every day.
However, the reliability of public transport services can often be compromised due to a variety of factors such as traffic congestion, weather conditions, and unexpected events.
Devices showing nearest public transport arrivals on given stop (like one on figure \ref{fig:teaser}), often require Internet access, introducing unnessesary network traffic and increasing city carbon footprint.
To combat climate change and reduce noise introduced by network traffic with devices syncing current tram and bus positions, change is required.
We propose to replace network-enabled embeded systems with networkless devices that contain prediction model described by this paper.
By reducing complexity of device by reduction of it's capabilities we can reduce production costs and availability of new devices.
We can additionally reduce device shown on figure \ref{fig:teaser} by displaying only the direction for the nearest tram or bus arrival.
This allows to reduce problem into multiclass classification.
\section{Related work}
Most of AI usage inside the public transportation context is concerned with optimization of schedules.
Searching for work that uses AI in interaction between passenger and public transport system is rather difficult.
Strongest connection can be found with general AI in public transport articles, especially ones overwieving applications of AI in public transport \cite{ai_in_transport}.
\section{Method}
\subsection{Dataset}
Dataset from which train and test data were created is publicly accessible public transport schedule information of ZTM Poznań \cite{ztm_dataset}.
Due to storage limit, few files from last few months are selected, resulting in \SI{400}{\mebi\byte} initial dataset size.
Then data is transformed from CSV format to TSV format, which is more suitable for standard shell text utilities consumption. Utility is written in Go for both performance and ease of use thanks to builtin CSV parser \cite{go_csv}.
Next, data is normalized using hand-written tool in C++: data notation is changed from \texttt{HH:MM} format to floating point representation when span from \texttt{00:00} to \texttt{23:59} is mapped to span $ \left[0, 1\right] $.
If row doesn't contain all required information then it's rejected.
All columns that are not nessesary are removed.
This results in \SI{176}{\mebi\byte} (originally \SI{400}{\mebi\byte}).
Training, validation and test data are extracted from normalized file using scikit-learn \cite{scikit_learn} function \texttt{train\_test\_split}.
All classes in dataset are extracted from normalized dataset using standard POSIX utilities: \texttt{cut}, \texttt{uniq}, \texttt{sort}.
\subsection{Model}
Model is implemented using Tensorflow \cite{tensorflow2015-whitepaper} framework, both to develop and evaluate.
Design of the model is driven by the computational capabilities of Lenovo Thinkpad x270 with i5-7300U processor and 8GB of RAM.
Model is constructed as shown below:
\begin{lstlisting}[language=Python]
from tf.keras import Sequential
from tf.keras.leyers import Input, Dense
model = Sequential([
Input(shape=(2,)),
Dense(4*num_classes,activation='relu'),
Dense(4*num_classes,activation='relu'),
Dense(4*num_classes,activation='relu'),
Dense(num_classes,activation='softmax')
])
\end{lstlisting}
Notable used activation function is softmax, defined as: $ \sigma(z)_i = \frac{e^{z_i}}{\sum_{j=1}^{K} e^{z_j}} $ for $ i = 1, \dots, K$ and $z = (z_1, \dots, z_K)$.
\section{Results}
Accuracy while training for 2 epochs, epoch size is 1024.
\begin{table}
\caption{Accuracy of trained model}
\label{tab:freq}
\begin{tabular}{c}
\toprule
Accuracy\\
\midrule
$0.20598010947207804$ \\
$0.20598010947207804$ \\
$0.18560214941090175$ \\
$0.19518890350138754$ \\
$0.19516771079968306$ \\
\bottomrule
\end{tabular}
\end{table}
Further evaluation and model training is required.
\section{Conclusions}
Due to available computational power (or lack there off) any conclusions about the solution are limited.
However, with model defined as above we can efficiently compress information - timetables storing required information for a month are \SI{62}{\mebi\byte} and stored model occupies only \SI{19}{\mebi\byte}.
Due to greater space-efficiency of AI powered solution, test deployment may be tested in the near future.
%%
%% The next two lines define the bibliography style to be used, and
%% the bibliography file.
\bibliographystyle{ACM-Reference-Format}
\bibliography{article}
\end{document}
\endinput

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +0,0 @@
\def\batchfile{samples.ins}
\input docstrip
\keepsilent
\showprogress
\askforoverwritefalse
\generate{%
\file{sample-manuscript.tex}{\from{samples.dtx}{manuscript}}
\file{sample-acmsmall.tex}{\from{samples.dtx}{acmsmall}}
\file{sample-acmsmall-submission.tex}{\from{samples.dtx}{acmsmall-submission}}
\file{sample-acmsmall-biblatex.tex}{\from{samples.dtx}{acmsmall-biblatex}}
\file{sample-acmlarge.tex}{\from{samples.dtx}{acmlarge}}
\file{sample-acmtog.tex}{\from{samples.dtx}{acmtog}}
\file{sample-sigconf.tex}{\from{samples.dtx}{sigconf}}
\file{sample-sigconf-biblatex.tex}{\from{samples.dtx}{sigconf-biblatex}}
\file{sample-authordraft.tex}{\from{samples.dtx}{authordraft}}
\file{sample-xelatex.tex}{\from{samples.dtx}{sigconf}}
\file{sample-lualatex.tex}{\from{samples.dtx}{sigconf}}
\file{sample-sigplan.tex}{\from{samples.dtx}{sigplan}}
\file{sample-acmsmall-conf.tex}{\from{samples.dtx}{acmsmall-conf}}
\file{sample-sigconf-i13n.tex}{\from{samples.dtx}{sigconf-i13n}}
\file{sample-acmengage.tex}{\from{samples.dtx}{acmengage}}
\file{sample-acmcp.tex}{\from{samples.dtx}{acmcp}}
}

View File

@ -1,145 +0,0 @@
@softwareversion {delebecque:hal-02090402-condensed,
title = {Scilab},
author = {Delebecque, Fran{\c c}ois and Gomez, Claude and Goursat, Maurice
and Nikoukhah, Ramine and Steer, Serge and Chancelier, Jean-Philippe},
url = {https://www.scilab.org/},
date = {1994-01},
file = {https://hal.inria.fr/hal-02090402/file/scilab-1.1.tar.gz},
institution = {Inria},
license = {Scilab license},
hal_id = {hal-02090402},
hal_version = {v1},
swhid = {swh:1:dir:1ba0b67b5d0c8f10961d878d91ae9d6e499d746a;
origin=https://hal.archives-ouvertes.fr/hal-02090402},
version = {1.1},
note = {First Scilab version. It was distributed by anonymous ftp.},
repository= {https://github.com/scilab/scilab},
abstract = {Software for Numerical Computation freely distributed.}
}
@software {delebecque:hal-02090402,
title = {Scilab},
author = {Delebecque, Fran{\c c}ois and Gomez, Claude and Goursat, Maurice
and Nikoukhah, Ramine and Steer, Serge and Chancelier, Jean-Philippe},
date = {1994},
institution = {Inria},
license = {Scilab license},
hal_id = {hal-02090402},
hal_version = {v1},
url = {https://www.scilab.org/},
abstract = {Software for Numerical Computation freely distributed.},
repository= {https://github.com/scilab/scilab},
}
@softwareversion {delebecque:hal-02090402v1,
version = {1.1},
date = {1994-01},
file = {https://hal.inria.fr/hal-02090402/file/scilab-1.1.tar.gz},
swhid = {swh:1:dir:1ba0b67b5d0c8f10961d878d91ae9d6e499d746a;
origin=https://hal.archives-ouvertes.fr/hal-02090402},
note = {First Scilab version. It was distributed by anonymous ftp.},
crossref = {delebecque:hal-02090402}
}
@software {cgal,
title = {The Computational Geometry Algorithms Library},
author = {{The CGAL Project}},
editor = {{CGAL Editorial Board}},
date = {1996},
url = {https://cgal.org/}
}
@softwareversion{cgal:5-0-2,
crossref = {cgal},
version = {{5.0.2}},
url = {https://docs.cgal.org/5.02},
date = {2020},
swhid = {swh:1:rel:636541bbf6c77863908eae744610a3d91fa58855;
origin=https://github.com/CGAL/cgal/}
}
@softwaremodule{cgal:lp-gi-20a,
crossref = {cgal:5-0-2},
author = {Menelaos Karavelas},
subtitle = {{2D} Voronoi Diagram Adaptor},
license = {GPL},
introducedin = {cgal:3-1},
url = {https://doc.cgal.org/5.0.2/Manual/packages.html#PkgVoronoiDiagram2},
}
@softwaremodule{cgal:lp-gi-20a-condensed,
title = {The Computational Geometry Algorithms Library},
subtitle = {{2D} Voronoi Diagram Adaptor},
author = {Menelaos Karavelas},
editor = {{CGAL Editorial Board}},
license = {GPL},
version = {{5.0.2}},
introducedin = {cgal:3-1},
date = {2020},
swhid = {swh:1:rel:636541bbf6c77863908eae744610a3d91fa58855;
origin=https://github.com/CGAL/cgal/},
url = {https://doc.cgal.org/5.0.2/Manual/packages.html#PkgVoronoiDiagram2},
}
@software {parmap,
title = {The Parmap library},
author = {Di Cosmo, Roberto and Marco Danelutto},
date = {2012},
institution = {{Inria} and {University of Paris} and {University of Pisa}},
license = {LGPL-2.0},
url = {https://rdicosmo.github.io/parmap/},
repository= {https://github.com/rdicosmo/parmap},
}
@softwareversion {parmap-1.1.1,
crossref = {parmap},
date = {2020},
version = {1.1.1},
swhid = {swh:1:rel:373e2604d96de4ab1d505190b654c5c4045db773;
origin=https://github.com/rdicosmo/parmap;
visit=swh:1:snp:2a6c348c53eb77d458f24c9cbcecaf92e3c45615},
}
@codefragment {simplemapper,
subtitle = {Core mapping routine},
swhid = {swh:1:cnt:43a6b232768017b03da934ba22d9cc3f2726a6c5;
origin=https://github.com/rdicosmo/parmap;
visit=swh:1:snp:2a6c348c53eb77d458f24c9cbcecaf92e3c45615;
anchor=swh:1:rel:373e2604d96de4ab1d505190b654c5c4045db773;
path=/src/parmap.ml;
lines=192-228},
crossref = {parmap-1.1.1}
}
@codefragment {simplemapper-condensed,
title = {The Parmap library},
author = {Di Cosmo, Roberto and Marco Danelutto},
date = {2020},
institution = {{Inria} and {University of Paris} and {University of Pisa}},
license = {LGPL-2.0},
url = {https://rdicosmo.github.io/parmap/},
repository= {https://github.com/rdicosmo/parmap},
version = {1.1.1},
subtitle = {Core mapping routine},
swhid = {swh:1:cnt:43a6b232768017b03da934ba22d9cc3f2726a6c5;
origin=https://github.com/rdicosmo/parmap;
visit=swh:1:snp:2a6c348c53eb77d458f24c9cbcecaf92e3c45615;
anchor=swh:1:rel:373e2604d96de4ab1d505190b654c5c4045db773;
path=/src/parmap.ml;
lines=192-228}
}
@article{ad-wood-2003,
author = {Christopher Anderson and Sophia Drossopoulou},
title = {{BabyJ}: from Object Based to Class Based Programming via Types},
journal = {{WOOD}},
volume = {82},
number = {7},
pages = {53--81},
year = {2003}
}
@softwareversion{gf-tag-sound-repo,
title={tag-sound},
author={Ben Greenman and Matthias Felleisen},
swhid={swh:1:dir:cd0b0abeee707e57cd699e2e2ebd075da8ebf1f7;origin=https://github.com/nuprl/tag-sound;visit=swh:1:snp:7967bc0abee8bf3bfffb9252207a07b73538525a;anchor=swh:1:rev:4cc09ca228947a99c8f4ac45eefb76e96ee96e53},
repository={https://github.com/nuprl/tag-sound},
version={4cc09ca},
date={2020}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 KiB

6
run.sh
View File

@ -1,6 +0,0 @@
#!/bin/sh
set -xe
docker build -t ium .
docker run -v .:/ium/ -it ium

2
src/.gitignore vendored
View File

@ -1,2 +0,0 @@
model.keras
pics

View File

@ -1,8 +0,0 @@
normalize: normalize.cc
g++ -std=c++20 -Wall -Wextra -O3 -o $@ $<
csv2tsv/csv2tsv: csv2tsv/csv2tsv.go
cd csv2tsv; go build
clean:
rm -f *.csv *.tsv stop*.txt trips.txt

View File

@ -1,108 +0,0 @@
#include <iostream>
#include <fstream>
#include <unordered_set>
#include <optional>
namespace split
{
struct sentinel {};
struct iterator
{
using difference_type = ptrdiff_t;
using value_type = std::string_view;
using iterator_category = std::input_iterator_tag;
using pointer = void;
using reference = std::string_view&;
explicit iterator(std::convertible_to<std::string_view> auto&& source, char delim)
: source{source}
, delim{delim}
{
++*this; // Compute first cell
}
inline iterator begin() const
{
return *this;
}
inline sentinel end() const
{
return sentinel{};
}
inline bool operator==(sentinel) const
{
return reached_end;
}
inline iterator& operator++()
{
if (source.empty()) {
reached_end = true;
return *this;
}
if (auto tab = source.find(delim); tab != std::string_view::npos) {
current = source.substr(0, tab);
source.remove_prefix(tab+1);
} else {
current = source;
source = {};
}
return *this;
}
inline iterator operator++(int)
{
auto copy = *this;
++*this;
return copy;
}
inline std::string_view operator*() const
{
return current;
}
std::string_view current;
std::string_view source;
char delim;
bool reached_end = false;
};
}
std::optional<float> time2float(std::string_view time)
{
if (time.size() != 8) return std::nullopt; // Expected time in format hh:mm:ss
auto const hours = ((time[0] - '0') * 10 + time[1] - '0');
auto const minutes = ((time[3] - '0') * 10 + time[4] - '0');
if (hours >= 24) return std::nullopt; // Single day has only 24 hours
return (float(hours) * 60 + float(minutes)) / (60 * 24);
}
int main()
{
std::cout.sync_with_stdio(false);
bool passed_header = false;
for (std::string line; std::getline(std::cin, line);) {
split::iterator row(line, '\t');
std::advance(row, 2); if (row == split::sentinel{}) continue; std::string_view const departure_time = *row;
std::advance(row, 1); if (row == split::sentinel{}) continue; std::string_view const stop_id = *row;
std::advance(row, 2); if (row == split::sentinel{}) continue; std::string_view const stop_headsign = *row;
if (!passed_header) {
std::cout << departure_time << '\t' << stop_id << '\t' << stop_headsign << '\n';
passed_header = true;
continue;
}
auto const departure = time2float(departure_time); if (!departure) continue;
std::cout << *departure << '\t' << stop_id << '\t' << stop_headsign << '\n';
}
}

View File

@ -1,45 +0,0 @@
#!/usr/bin/env bash
set -xe -o pipefail
# Go requires presence of this variable with some sensible directory
export XDG_CACHE_HOME="/tmp/xdg_cache_home/"
mkdir -p "$XDG_CACHE_HOME"
make normalize csv2tsv/csv2tsv
keep=stop_times.txt
mkdir -p data && cd data
xargs -- wget --no-verbose --no-clobber <../ztm-data.txt
for file in $(find . -name 'index*.zip'); do
dir="${file##*=}"
dir="${dir%.zip}"
if [ ! -d "$dir" ]; then
mkdir "$dir"
unzip "$file" -d "$dir" "${keep[@]}"
fi
done
cd ..
for k in "${keep[@]}"; do
csv="${k%.txt}.csv"
tsv="${k%.txt}.tsv"
if [ ! -f "$tsv" ]; then
cat $(find data -name "$k") > "$csv"
csv2tsv/csv2tsv <"$csv" >"$tsv"
fi
done
if [ ! -f "stop_times.normalized.tsv" ]; then
./normalize <stop_times.tsv >stop_times.normalized.tsv
fi
if [ ! \( -f "stop_times.train.tsv" -a -f "stop_times.test.tsv" -a -f "stop_times.valid.tsv" \) ]; then
./split_train_valid_test.py
fi
head -n 1 stop_times.normalized.tsv | cut -f3- > stop_times.categories.tsv
tail -n +2 stop_times.normalized.tsv | cut -f3- | uniq | sort | uniq >> stop_times.categories.tsv

View File

@ -1,12 +0,0 @@
#!/usr/bin/env python3
import pandas as pd
from sklearn.model_selection import train_test_split
data = pd.read_csv('./stop_times.normalized.tsv', sep='\t')
train, test = train_test_split(data, test_size=0.8)
valid, test = train_test_split(test, test_size=0.5)
train.to_csv('stop_times.train.tsv', sep='\t')
test.to_csv('stop_times.test.tsv', sep='\t')
valid.to_csv('stop_times.valid.tsv', sep='\t')

View File

@ -1,51 +0,0 @@
#!/usr/bin/env python3
import math
import os
import pandas as pd
import contextlib
pd.set_option('display.float_format', lambda x: '%.5f' % x)
def float2time(d: float):
hours = math.floor(d * 24)
minutes = math.floor(d * 24 * 60 - hours * 60)
return "%s:%s" % tuple(str(x).rjust(2,'0') for x in (hours, minutes))
data = pd.read_csv(f'./stop_times.normalized.tsv', sep='\t', dtype={ 'departure_time': float, 'stop_id': str, 'stop_headsign': str })
print("--- Pictures -------------------------------------------------")
with contextlib.suppress(Exception):
os.mkdir("pics")
(data["departure_time"] * 24).plot(kind='hist', title="Częstotliwość czasu odjazdu").get_figure().savefig('pics/departure_time_frequency.png')
print("pics/departure_time_frequency.png")
data["stop_headsign"].value_counts().plot(kind='pie', title="Popularność celu").get_figure().savefig('pics/stop_headsign_popularity.png')
print("pics/stop_headsign_popularity.png")
print("--- Minmum departure time per stop headsign ------------------")
shgroup = data.groupby('stop_headsign').min(numeric_only=True)
shgroup["departure_time"] = shgroup["departure_time"].map(float2time)
print(shgroup)
print()
print("--- Maximum departure time per stop headsign -----------------")
shgroup = data.groupby('stop_headsign').max(numeric_only=True)
shgroup["departure_time"] = shgroup["departure_time"].map(float2time)
print(shgroup)
print()
print("--- Mean departure time per stop headsign --------------------")
shgroup = data.groupby('stop_headsign').mean(numeric_only=True)
shgroup["departure_time"] = shgroup["departure_time"].map(float2time)
print(shgroup)
print()
print("--- Normalized data statistics -------------------------------")
print(data.describe(include='all'))
for subset in ['train', 'valid', 'test']:
print(f"--- {subset.title()} data statistics -------------------------------")
data = pd.read_csv(f'./stop_times.{subset}.tsv', sep='\t', dtype={ 'departure_time': float, 'stop_id': str, 'stop_headsign': str })
print(data.describe(include='all'))

View File

@ -1,24 +0,0 @@
from tf_train import *
import numpy as np
from sklearn.metrics import accuracy_score
def test():
global model, le
test_x, test_y, _ = load_data('./stop_times.test.tsv', le)
test_x = tf.convert_to_tensor(test_x, dtype=tf.float32)
test_y = tf.convert_to_tensor(test_y)
model = tf.keras.models.load_model('model.keras')
predictions = np.argmax(model.predict(test_x), 1)
with open('stop_times.predictions.tsv', 'w') as f:
f.write('stop_headsign\n')
for x in le.inverse_transform(predictions):
print(x, file=f)
with open('stop_times.accuracy.tsv', 'a') as f:
print(accuracy_score(test_y, predictions), file=f, sep='\t')
if __name__ == "__main__":
test()

View File

@ -1,55 +0,0 @@
#!/usr/bin/env python3
import pandas as pd
import tensorflow as tf
from sklearn.preprocessing import LabelEncoder
pd.set_option('display.float_format', lambda x: '%.5f' % x)
le = LabelEncoder()
le.fit([x.strip() for x in pd.read_csv('./stop_times.categories.tsv', sep='\t')['stop_headsign'].to_numpy()])
def load_data(path: str, le: LabelEncoder):
train = pd.read_csv(path, sep='\t', dtype={ 'departure_time': float, 'stop_id': str, 'stop_headsign': str })
departure_time = train['departure_time'].to_numpy()
stop_id = train['stop_id'].to_numpy()
stop_headsign = [x.strip() for x in train['stop_headsign'].to_numpy()]
stop_headsign = le.transform(stop_headsign)
x = [[d, int(s)] for d, s in zip(departure_time, stop_id)]
return x, stop_headsign, le
num_classes = len(le.classes_)
def train(epochs: int):
global le
model = tf.keras.Sequential([
tf.keras.layers.Input(shape=(2,)),
tf.keras.layers.Dense(4 * num_classes, activation='relu'),
tf.keras.layers.Dense(4 * num_classes, activation='relu'),
tf.keras.layers.Dense(4 * num_classes, activation='relu'),
tf.keras.layers.Dense(num_classes, activation='softmax')
])
model.compile(optimizer='adam',
loss=tf.keras.losses.SparseCategoricalCrossentropy(),
metrics=['accuracy'])
train_x, train_y, _ = load_data('./stop_times.train.tsv', le)
train_x = tf.convert_to_tensor(train_x, dtype=tf.float32)
train_y = tf.convert_to_tensor(train_y)
valid_x, valid_y, _ = load_data('./stop_times.valid.tsv', le)
valid_x = tf.convert_to_tensor(valid_x, dtype=tf.float32)
valid_y = tf.convert_to_tensor(valid_y)
model.fit(train_x, train_y, validation_data=(valid_x, valid_y), epochs=epochs, batch_size=1024)
model.save('model.keras')
if __name__ == "__main__":
import sys
epochs = int('2' if len(sys.argv) != 2 else sys.argv[1])
train(epochs)

View File

@ -1,7 +0,0 @@
https://www.ztm.poznan.pl/pl/dla-deweloperow/getGTFSFile/?file=20210301_20210331.zip
https://www.ztm.poznan.pl/pl/dla-deweloperow/getGTFSFile/?file=20220321_20220410.zip
https://www.ztm.poznan.pl/pl/dla-deweloperow/getGTFSFile/?file=20230223_20230228.zip
https://www.ztm.poznan.pl/pl/dla-deweloperow/getGTFSFile/?file=20230224_20230228.zip
https://www.ztm.poznan.pl/pl/dla-deweloperow/getGTFSFile/?file=20230227_20230228.zip
https://www.ztm.poznan.pl/pl/dla-deweloperow/getGTFSFile/?file=20230301_20230331.zip
https://www.ztm.poznan.pl/pl/dla-deweloperow/getGTFSFile/?file=20230317_20230430.zip

View File

@ -1,23 +0,0 @@
node {
checkout scm
def local_image = docker.build("s452639-image")
local_image.inside {
stage('Build') {
checkout([$class: 'GitSCM', branches: [[name: 'ztm']], extensions: [], userRemoteConfigs: [[url: 'https://git.wmi.amu.edu.pl/s452639/ium_452639']]])
copyArtifacts fingerprintArtifacts: true,
projectName: 's452639-create-dataset',
selector: buildParameter('BUILD_SELECTOR'),
flatten: true,
target: 'src/'
sh 'echo xd1; ls -l'
sh 'echo xd2; cd src; ls -l'
sh 'cd src; ./stats.py > stats.txt'
archiveArtifacts artifacts: 'src/stats.txt', followSymlinks: false
}
}
}

View File

@ -1,17 +0,0 @@
FROM ubuntu:22.04
RUN apt update && apt install -y vim make python3 python3-pip python-is-python3 gcc g++ golang wget unzip git
RUN pip install pandas matplotlib scikit-learn tensorflow
RUN mkdir /ium
COPY .. /ium
WORKDIR /ium/src/
RUN wget https://bendun.students.wmi.amu.edu.pl/stop_times.train.tsv
RUN wget https://bendun.students.wmi.amu.edu.pl/stop_times.valid.tsv
RUN wget https://bendun.students.wmi.amu.edu.pl/stop_times.categories.tsv
VOLUME /github/workspace/
ENTRYPOINT ["/ium/train-action/entrypoint.sh"]

View File

@ -1,5 +0,0 @@
#!/bin/sh
cd /ium/src
python3 tf_train.py "$1"
cp /ium/src/model.keras /github/workspace/

View File

@ -1,12 +0,0 @@
name: Train
description: 'Train model'
inputs:
epochs:
description: 'Number of epochs'
required: true
default: '2'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.epochs }}

View File

@ -1,44 +0,0 @@
node {
checkout scm
stage('Init') {
properties([
pipelineTriggers([ upstream(threshold: hudson.model.Result.SUCCESS, upstreamProjects: 's452639-create-dataset' ) ]),
parameters([
buildSelector(
defaultSelector: lastSuccessful(),
description: "Source of dataset",
name: 'BUILD_SELECTOR'
),
string(
defaultValue: "2",
description: "Epochs count",
name: "EPOCHS",
trim: true
),
])
])
}
def local_image = docker.build("s452639-image")
local_image.inside {
stage('Build') {
checkout([$class: 'GitSCM', branches: [[name: BRANCH_NAME]], extensions: [], userRemoteConfigs: [[url: 'https://git.wmi.amu.edu.pl/s452639/ium_452639']]])
copyArtifacts fingerprintArtifacts: true,
projectName: 's452639-create-dataset',
selector: lastSuccessful(),
flatten: true,
target: 'src/'
sh 'cd src; python tf_train.py $EPOCHS'
archiveArtifacts artifacts: 'src/model.keras', followSymlinks: false
}
}
stage('Trigger') {
build wait: false, job: 's452639-evaluation.eg'
}
}

1
tsv2json/json Submodule

@ -0,0 +1 @@
Subproject commit 822784d0ebce101249e38d928ce69033e30455f4

437
tsv2json/tsv2json.cc Normal file
View File

@ -0,0 +1,437 @@
#define IMM_JSON_IMPLEMENTATION
#include "json/imm_json.hh"
#include <cassert>
#include <cctype>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <memory>
#include <optional>
#include <span>
#include <utility>
namespace split
{
struct sentinel {};
struct iterator
{
using difference_type = ptrdiff_t;
using value_type = std::string_view;
using iterator_category = std::input_iterator_tag;
using pointer = void;
using reference = std::string_view&;
explicit iterator(std::convertible_to<std::string_view> auto&& source, char delim)
: source{source}
, delim{delim}
{
++*this; // Compute first cell
}
inline iterator begin() const
{
return *this;
}
inline sentinel end() const
{
return sentinel{};
}
inline bool operator==(sentinel) const
{
return reached_end;
}
inline iterator& operator++()
{
if (source.empty()) {
reached_end = true;
return *this;
}
if (auto tab = source.find(delim); tab != std::string_view::npos) {
current = source.substr(0, tab);
source.remove_prefix(tab+1);
} else {
current = source;
source = {};
}
return *this;
}
inline iterator operator++(int)
{
auto copy = *this;
++*this;
return copy;
}
inline std::string_view operator*() const
{
return current;
}
std::string_view current;
std::string_view source;
char delim;
bool reached_end = false;
};
}
struct Expression
{
enum Type
{
Symbol,
Call,
};
Type type;
std::string_view symbol;
std::vector<Expression> sub{};
Expression(std::string_view symbol)
: type{Type::Symbol}
, symbol{symbol}
{
}
Expression(std::string_view name, Expression &&arg)
: type{Type::Call}
, symbol{name}
, sub{std::move(arg)}
{
}
friend std::ostream& operator<<(std::ostream& os, Expression const& expr)
{
switch (expr.type) {
break; case Type::Symbol: os << std::quoted(expr.symbol);
break; case Type::Call: os << expr.symbol << '(' << expr.sub.front() << ')';
}
return os;
}
};
std::vector<Expression> parse_normalization_expression(std::string_view &source)
{
auto const skip_ws = [&] {
if (auto after_ws = source.find_first_not_of(" \t"); after_ws != std::string_view::npos) {
source.remove_prefix(after_ws);
}
};
std::vector<Expression> sequence;
for (;;) {
std::string_view symbol;
skip_ws();
// FIXME String escaping
if (source.starts_with('"')) {
source.remove_prefix(1);
auto const string_end = source.find('"');
if (string_end == std::string_view::npos) {
std::cerr << "[ERROR] Failed to parse '" << source << "': expected end of string\n";
std::exit(2);
}
std::string_view symbol{source.begin(), string_end};
source.remove_prefix(string_end+1);
skip_ws();
sequence.emplace_back(symbol);
goto next;
}
{
// Don't use islower since it uses locale (slow)
auto const symbol_end = std::find_if_not(source.begin(), source.end(), [](char c) { return c >= 'a' && c <= 'z'; });
if (symbol_end == source.begin()) {
std::cerr << "[ERROR] Failed to parse '" << source << "': expected symbol\n";
std::exit(2);
}
symbol = std::string_view{source.begin(), symbol_end};
source.remove_prefix(symbol.size());
skip_ws();
}
if (source.empty()) {
sequence.emplace_back(symbol);
goto next;
}
if (source.starts_with("(")) {
source.remove_prefix(1);
// FIXME Should separate expression sequence and expression argument parsing
sequence.emplace_back(symbol, std::move(parse_normalization_expression(source).front()));
skip_ws();
if (!source.starts_with(")")) {
std::cerr << "[ERROR] Failed to parse '" << source << "': expected closing bracket\n";
std::exit(2);
}
source.remove_prefix(1);
goto next;
}
next:
skip_ws();
if (source.starts_with('.')) {
source.remove_prefix(1);
continue;
} else {
break;
}
}
return sequence;
}
struct Value
{
enum class Type
{
Null,
Bool,
Number,
String,
Vector,
};
Type type = Type::Null;
bool boolean = false;
std::string string{};
double number = 0;
std::vector<Value> vector{};
explicit Value()
: type(Type::Null)
{
}
explicit Value(bool b)
: type(Type::Bool)
, boolean(b)
{
}
explicit Value(std::string_view s)
: type(Type::String)
, string(s)
{
}
explicit Value(double number)
: type(Type::Number)
, number(number)
{
}
explicit Value(std::vector<Value> vector)
: type(Type::Vector)
, vector(std::move(vector))
{
}
};
Json& operator+=(Json& json, Value const& value)
{
switch (value.type) {
break; case Value::Type::Null: json = nullptr;
break; case Value::Type::Bool: json = value.boolean;
break; case Value::Type::String: json = value.string;
break; case Value::Type::Number: json = value.number;
break; case Value::Type::Vector:
{
auto _array = json.array();
for (auto const& element : value.vector) json += element;
}
}
return json;
}
struct Builtin
{
std::string_view name;
Value(*handler)(Value, std::optional<std::string_view>);
bool accepts_vector = false;
};
using Env = std::vector<Builtin>;
Value eval(std::vector<Expression> const& expressions, Value value, Env const& env)
{
for (auto const& expr : expressions) {
auto builtin = std::find_if(env.begin(), env.end(), [expr](Builtin const& b) { return b.name == expr.symbol; });
if (builtin == env.end()) {
std::cerr << "[ERROR] Unknown builtin: " << expr.symbol << '\n';
std::exit(1);
}
if (!builtin->accepts_vector && value.type == Value::Type::Vector) {
for (auto &element : value.vector) {
switch (expr.type) {
break; case Expression::Symbol:
element = builtin->handler(std::move(element), std::nullopt);
break; case Expression::Call:
assert(expr.sub.size() == 1);
assert(expr.sub.front().type == Expression::Symbol);
element = builtin->handler(std::move(element), expr.sub[0].symbol);
}
}
} else {
switch (expr.type) {
break; case Expression::Symbol:
value = builtin->handler(std::move(value), std::nullopt);
break; case Expression::Call:
assert(expr.sub.size() == 1);
assert(expr.sub.front().type == Expression::Symbol);
value = builtin->handler(std::move(value), expr.sub[0].symbol);
}
}
}
return value;
}
struct Column
{
Column(std::string_view name, std::string_view normalization_expression)
: name(name)
, expression_source(normalization_expression)
, expression()
{
expression = parse_normalization_expression(normalization_expression);
}
inline Value normalize(std::string_view source, Env const& env)
{
return eval(expression, Value(source), env);
}
std::string_view name;
std::string_view expression_source;
std::vector<Expression> expression;
};
int main(int argc, char** argv)
{
if (argc != 2) {
std::cerr << "usage: " << argv[0] << " <columns.tsv>\n";
std::cerr << " convert tsv file from TSV using definitions from columns.tsv\n";
}
std::ifstream columns_file(argv[1]);
static std::string source{std::istreambuf_iterator<char>(columns_file), {}};
if (auto it = std::next(split::iterator(source, '\t'), 1); it == split::sentinel{} || *it != "Type") {
std::cerr << "[ERROR] Expected Type description in column 2\n";
return 1;
}
std::vector<Column> columns;
for (std::string_view line : split::iterator(source, '\n')) {
auto tsv_it = split::iterator(line, '\t');
if (tsv_it == split::sentinel{} || !(*tsv_it++).starts_with("y")) { continue; }
auto const type = *tsv_it++; if (tsv_it == split::sentinel{}) continue;
[[maybe_unused]] auto const _column_number = *tsv_it++; if (tsv_it == split::sentinel{}) continue;
auto const name = *tsv_it++;
columns.emplace_back(name, type);
}
Env env = {
Builtin { "lower", +[](Value v, std::optional<std::string_view>) -> Value {
assert(v.type == Value::Type::String);
// FIXME Proper UTF-8 lowercase
// However, manual inspection of used TSV files prooved that there aren't any non-ascii uppercase letters
for (char &c : v.string) {
if (c >= 'A' && c <= 'Z') {
c = c - 'A' + 'a';
}
}
return v;
}},
Builtin { "int", +[](Value v, std::optional<std::string_view>) -> Value {
assert(v.type == Value::Type::String);
long long int n;
std::cout.flush();
if (v.string.empty()) {
return Value{};
}
auto [p, ec] = std::from_chars(v.string.data(), v.string.data() + v.string.size(), n);
if (ec != std::errc{}) {
return Value{};
}
return Value(double(n));
}},
Builtin { "bool", +[](Value v, std::optional<std::string_view>) -> Value {
assert(v.type == Value::Type::String);
return Value(v.string.empty());
}},
Builtin { "str", +[](Value v, std::optional<std::string_view>) -> Value {
assert(v.type == Value::Type::String);
return v;
}},
Builtin { "sep", +[](Value v, std::optional<std::string_view> by) -> Value {
assert(by && "sep requires parameter by which it can split");
assert(v.type == Value::Type::String && "only string can be splitted");
std::vector<Value> separated;
std::string_view source = v.string;
for (;;) if (auto split_point = source.find(*by); split_point != std::string_view::npos) {
separated.emplace_back(source.substr(0, split_point));
source.remove_prefix(split_point + by->size());
} else {
break;
}
if (source.size()) {
separated.emplace_back(source);
}
return Value(std::move(separated));
}},
Builtin {
.name = "unless",
.handler = +[](Value v, std::optional<std::string_view> needle) -> Value {
assert(v.type == Value::Type::String);
assert(needle && "Unless requires string to search for");
if (v.string.find(*needle) == std::string::npos)
return v;
return Value("");
},
.accepts_vector = false
}
};
{
bool passed_header = false;
Json json;
auto _array = json.array();
for (std::string line; std::getline(std::cin, line);) {
if (!passed_header) {
passed_header = true;
continue;
}
auto _object = json.object();
auto tsv = split::iterator(line, '\t');
for (auto column = 0u; tsv != split::sentinel{}; ++column, ++tsv) {
assert(column < columns.size());
json.key(columns[column].name) += columns[column].normalize(*tsv, env);
}
break;
}
}
return 0;
}