You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

197 lines
7.6 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. # doccano
  2. [![Build Status](https://travis-ci.org/chakki-works/doccano.svg?branch=master)](https://travis-ci.org/chakki-works/doccano)
  3. doccano is an open source text annotation tool for human. It provides annotation features for text classification, sequence labeling and sequence to sequence. So, you can create labeled data for sentiment analysis, named entity recognition, text summarization and so on. Just create project, upload data and start annotation. You can build dataset in hours.
  4. ## Demo
  5. You can enjoy [annotation demo](http://doccano.herokuapp.com).
  6. ### [Named entity recognition](https://doccano.herokuapp.com/demo/named-entity-recognition/)
  7. First demo is one of the sequence labeling tasks, named-entity recognition. You just select text spans and annotate it. Since doccano supports shortcut key, so you can quickly annotate text spans.
  8. ![Named Entity Recognition](./docs/named_entity_annotation.gif)
  9. ### [Sentiment analysis](https://doccano.herokuapp.com/demo/text-classification/)
  10. Second demo is one of the text classification tasks, topic classification. Since there may be more than one category, you can annotate multi-labels.
  11. ![Text Classification](./docs/text_classification.gif)
  12. ### [Machine translation](https://doccano.herokuapp.com/demo/translation/)
  13. Final demo is one of the sequence to sequence tasks, machine translation. Since there may be more than one responses in sequence to sequence tasks, you can create multi responses.
  14. ![Machine Translation](./docs/translation.gif)
  15. ## Features
  16. * Collaborative annotation
  17. * Language independent
  18. * (future) Auto labeling
  19. ## Requirements
  20. * Python 3.6+
  21. * django 2.0.5+
  22. * Google Chrome(highly recommended)
  23. ## Installation
  24. To install doccano, simply run:
  25. ```bash
  26. $ git clone https://github.com/chakki-works/doccano.git
  27. $ cd doccano
  28. $ pip install -r requirements.txt
  29. $ cd app
  30. ```
  31. First we need to make migration. Run the following command:
  32. ```bash
  33. $ python manage.py migrate
  34. ```
  35. Next we need to create a user who can login to the admin site. Run the following command:
  36. ```bash
  37. $ python manage.py createsuperuser
  38. ```
  39. Enter your desired username and press enter.
  40. ```bash
  41. Username: admin
  42. ```
  43. You will then be prompted for your desired email address:
  44. ```bash
  45. Email address: admin@example.com
  46. ```
  47. The final step is to enter your password. You will be asked to enter your password twice, the second time as a confirmation of the first.
  48. ```bash
  49. Password: **********
  50. Password (again): *********
  51. Superuser created successfully.
  52. ```
  53. ## Usage
  54. ### Start the development server
  55. Let’s start the development server and explore it.
  56. If the server is not running start it like so:
  57. ```bash
  58. $ python manage.py runserver
  59. ```
  60. Now, open a Web browser and go to <http://127.0.0.1:8080/login/>. You should see the login screen:
  61. <img src="./docs/login_form.png" alt="Login Form" width=400>
  62. ### Create a project
  63. Now, try logging in with the superuser account you created in the previous step. You should see the doccano project list page:
  64. <img src="./docs/projects.png" alt="projects" width=600>
  65. There is no project created yet. To create your project, make sure you’re in the project list page and select `Create Project` button. You should see the following screen:
  66. <img src="./docs/create_project.png" alt="Project Creation" width=400>
  67. In this step, you can select three project types: text classificatioin, sequence labeling and sequence to sequence. You should select a type with your purpose.
  68. ### Import Data
  69. After creating a project, you will see the "Import Data" page, or click `Import Data` button in the navigation bar. You should see the following screen:
  70. <img src="./docs/upload.png" alt="Upload project" width=600>
  71. You can upload two types of files:
  72. - `CSV file`: file must contain a header with a `text` column or be one-column csv file.
  73. - `JSON file`: each line contains a JSON object with a `text` key. JSON format supports line breaks rendering.
  74. > Notice: Doccano won't render line breaks in annotation page for sequence labeling task due to the indent problem, but the exported JSON file still contains line breaks.
  75. `example.txt` (or `example.csv`)
  76. ```python
  77. EU rejects German call to boycott British lamb.
  78. President Obama is speaking at the White House.
  79. He lives in Newark, Ohio.
  80. ...
  81. ```
  82. `example.json`
  83. ```JSON
  84. {"text": "EU rejects German call to boycott British lamb."}
  85. {"text": "President Obama is speaking at the White House."}
  86. {"text": "He lives in Newark, Ohio."}
  87. ...
  88. ```
  89. Any other columns (for csv) or keys (for json) are preserved and will be exported in the `metadata` column or key as is.
  90. Once you select a TXT/JSON file on your computer, click `Upload dataset` button. After uploading the dataset file, we will see the `Dataset` page (or click `Dataset` button list in the left bar). This page displays all the documents we uploaded in one project.
  91. ### Define labels
  92. Click `Labels` button in left bar to define your own labels. You should see the label editor page. In label editor page, you can create labels by specifying label text, shortcut key, background color and text color.
  93. <img src="./docs/label_editor.png" alt="Edit label" width=600>
  94. ### Annotation
  95. Now, you are ready to annotate the texts. Just click the `Annotate Data` button in the navigation bar, you can start to annotate the documents you uploaded.
  96. <img src="./docs/annotation.png" alt="Edit label" width=600>
  97. ### Export Data
  98. After the annotation step, you can download the annotated data. Click the `Edit data` button in navigation bar, and then click `Export Data`. You should see below screen:
  99. <img src="./docs/export_data.png" alt="Edit label" width=600>
  100. You can export data as CSV file or JSON file by clicking the button. As for the export file format, you can check it here: [Export File Formats](https://github.com/chakki-works/doccano/wiki/Export-File-Formats).
  101. Each exported document will have metadata column or key, which will contain
  102. additional columns or keys from the imported document. The primary use-case for metadata is to allow you to match exported data with other system
  103. by adding `external_id` to the imported file. For example:
  104. Input file may look like this:
  105. `import.json`
  106. ```JSON
  107. {"text": "EU rejects German call to boycott British lamb.", "external_id": 1}
  108. ```
  109. and the exported file will look like this:
  110. `output.json`
  111. ```JSON
  112. {"doc_id": 2023, "text": "EU rejects German call to boycott British lamb.", "labels": ["news"], "username": "root", "metadata": {"external_id": 1}}
  113. ```
  114. ### Tutorial
  115. We prepared a NER annotation tutorial, which can help you have a better understanding of doccano. Please first read the README page, and then take the tutorial. [A Tutorial For Sequence Labeling Project](https://github.com/chakki-works/doccano/wiki/A-Tutorial-For-Sequence-Labeling-Project).
  116. I hope you are having a great day!
  117. ## Contribution
  118. As with any software, doccano is under continuous development. If you have requests for features, please file an issue describing your request. Also, if you want to see work towards a specific feature, feel free to contribute by working towards it. The standard procedure is to fork the repository, add a feature, fix a bug, then file a pull request that your changes are to be merged into the main repository and included in the next release.
  119. Here are some tips might be helpful. [How to Contribute to Doccano Project](https://github.com/chakki-works/doccano/wiki/How-to-Contribute-to-Doccano-Project)
  120. ## Contact
  121. For help and feedback, please feel free to contact [the author](https://github.com/Hironsan).
  122. **If you are favorite to doccano, please follow my [GitHub](https://github.com/Hironsan) and [Twitter](https://twitter.com/Hironsan13) account.**