{"id":19431335,"url":"https://github.com/zalandoresearch/zap","last_synced_at":"2025-04-24T18:34:43.385Z","repository":{"id":25870554,"uuid":"105031330","full_name":"zalandoresearch/zap","owner":"zalandoresearch","description":"Multilingual NLP annotation projection","archived":false,"fork":false,"pushed_at":"2022-05-20T20:46:31.000Z","size":88218,"stargazers_count":49,"open_issues_count":4,"forks_count":10,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-05-02T04:19:19.262Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zalandoresearch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-27T14:50:39.000Z","updated_at":"2024-03-31T14:20:01.000Z","dependencies_parsed_at":"2022-08-30T10:10:34.096Z","dependency_job_id":null,"html_url":"https://github.com/zalandoresearch/zap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalandoresearch%2Fzap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalandoresearch%2Fzap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalandoresearch%2Fzap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zalandoresearch%2Fzap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zalandoresearch","download_url":"https://codeload.github.com/zalandoresearch/zap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223964753,"owners_count":17232907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T14:29:10.669Z","updated_at":"2024-11-10T14:29:11.209Z","avatar_url":"https://github.com/zalandoresearch.png","language":"Java","funding_links":[],"categories":["人工智能"],"sub_categories":["自然语言处理"],"readme":"# ZAP - Multilingual Annotation Projection Framework\n\n`ZAP` is a [Zalando](https://jobs.zalando.com/tech/) framework for **projection of linguistic annotation** in parallel corpora. The framework \n enables us to **automaticallly generate linguistic resources (such as treebanks \nor propbanks) for new languages**, using a method referred to as *annotation projection* or *annotation transfer*. \n\nBelow an example of an English (top) and German (bottom) sentence pair. English annotations are automatically \nprojected onto the German sentence, labeling it with named entities, semantic roles and PoS tags.\n\n![](doc/img/projection-example.png)\n\n## Included Components\n\nThe framework packages everything required to execute annotation projection in a set \nof very simple, lightweight Java methods. It includes: \n\n1. **Syntactic and Semantic Parsers**: We wrap open source libraries such as StanfordNLP, ANNA and Mate, so that syntactic parsing and\n semantic role labeling can be easily executed for all supported languages.\n2. **Word Alignment**: We provide a heuristic alignment class that uses word translation probabilities computed for \nlarge-scale parallel corpora to automatically word-align sentence pairs in all supported language pairs.\n3. **Annotation Transfer**: We provide an implementation of annotation transfer for a range of linguistic annotation,\n including part-of-speech tags, named entities, typed dependencies and semantic roles.\n4. **Visualization**: We include a web-based UI called ``TheProjector``, \nuseful for inspecting sentence alignments and annotation projection. \n\n\nThis readme briefly illustrates their usage.\n\n## Getting Started\n\n### Dependencies\n\n- Java 8\n- Maven\n\n### Installation\n\nAll you need to do is add this dependency to your project's `pom.xml` file:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.zalando.research\u003c/groupId\u003e\n    \u003cartifactId\u003ezap\u003c/artifactId\u003e\n    \u003cversion\u003e1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\nAnd you're set to get started!\n\n## Usage\n\n### Parse a sentence\nWe provide simple wrappers to enable you to quickly execute NLP tools to sentences in one of the supported languages.\nTo parse an English sentence, simply instantiate the PipelineWrapper object for English:  \n  \n```java\n// create parsing pipeline object\nPipelineWrapper pipeline = new PipelineWrapper(Language.ENGLISH);\n\n// use pipeline to parse English sentence provided as string\nSentence parse = pipeline.parse(\"The cat was eating cheese.\");\n```\n\n### Parse a sentence in German\nIf you want to parse a sentence in another language, simply pass another Language enum to the constructor of the\n PipelineWrapper.\n \n ```java\n// create parsing pipeline object\n PipelineWrapper pipeline = new PipelineWrapper(Language.GERMAN);\n \n// use pipeline to parse German sentence provided as string\n Sentence parse = pipeline.parse(\"Die Katze aß gerade Käse.\");\n ```\n\n### Create and align a bi-sentence\n\nBi-sentences are two sentences that are translations of one another and a core component in annotation projection.\nFirst, instantiate a BiSentence object with a source and target language sentence. In this example, we parse only the \nsource sentence and initialize the German target sentence without annotations (i.e. no PoS-tags, dependencies etc.).\n\n```java\n// create parsing pipeline object\nPipelineWrapper pipeline = new PipelineWrapper(Language.ENGLISH);\n\n// use pipeline to parse English sentence provided as string\nSentence sourceSentence = pipeline.parse(\"The cat was eating cheese.\");\n\n// initialize German target sentence without annotations\nSentence targetSentence = Sentence.fromTokenized(\"Die Katze aß gerade Käse .\");\n\n// create BiSentence object holding source and target Sentence\nBiSentence biSentence = new BiSentence(sourceSentence, targetSentence);\n\n```\n\nNow you can use the HeuristicAligner to word-align both sentences. \n\n```java\n// initialize aligner for English-German\nHeuristicAligner aligner = HeuristicAligner.getInstance(Language.GERMAN); \n\n// align the BiSentence\nbiSentence.align(aligner);\n\n// print alignment\nSystem.out.println(biSentence);\n```\n\nIf you print the alignment, you should get something like this:\n\n\n\n### Project annotation in BiSentence\n\nIf you have completed the above steps to instantiate and word-align a BiSentence, you can use the AnnotationTransfer\nclass to transfer annotations from source to target sentence. \n\n```java\nnew AnnotationTransfer().transfer(biSentence);\n```\n\nDone! An annotated German sentence has been generated! You may print it in conll-u format by calling \n\n```java\nSystem.out.println(biSentence.getSentenceTL().toConllU());\n```\n\n\n## Visualization and exploration\n\nWe include ``TheProjector``, a Web UI useful for inspecting sentence alignments and annotation projection. \nAll you need to do is call the following method:\n\n```java\nTheProjectorUI.startServerAtPort(9000);\n```\n\nThen navigate your browser to ``localhost:9000``, where you should see the UI as indicated be the screenshot below.\nHere, you can either select a corpus, or the manual mode to execute annotation projection. For more information on\n``TheProjector``, refer to the following [paper](http://alanakbik.github.io/papers/EMNLP2017_demo_final.pdf).\n\n![](doc/img/ui-example.png)\n\n## Contributing\n\nThanks for your interest in contributing! There are many ways to get involved; \nstart with our [contributor guidelines](/CONTRIBUTING.md) and then \ncheck these [open issues](https://github.com/zalandoresearch/zap/issues) for specific tasks.\n\nFor contributors looking to get deeper into the API we suggest cloning the repository and checking out the unit \ntests for examples of how to call methods. Nearly all classes and methods are documented, so finding your way around \nthe code should hopefully be easy.\n\n\n## License\n\nZAP is in general licensed under the following MIT license: The MIT License (MIT) Copyright © 2017 Zalando SE, https://tech.zalando.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzalandoresearch%2Fzap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzalandoresearch%2Fzap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzalandoresearch%2Fzap/lists"}