# Tagging System

Addresses user stories [#1], [#4], [#5].

The tagging system will be at the center of organizing the library. Therefore it needs to be done correctly. You are invited to question and discuss everything in this document.

A "[[...] tag is a keyword or term assigned to a piece of information](https://en.wikipedia.org/wiki/Tag_(metadata\))". Things which I do not consider tags:

- author/groups
- source material of fan art
- characters
- language/translation

You should still be able to filter by these things, but their semantic difference disqualifies them as generic tags.

## Why?

**The purpose of tags is to find something specific**. A user should be able to put in what he wants and does not want, and the application should serve it.

## How?

A user should be able to add tags to works in their library. This addresses [#1], but does not enable the discovery of new manga. For this to be possible, existing sites need to be searched. This requires a way to unify the existing tagging systems.

Before a way to do that can be established, we first need to decide if users should be able to define their own tags or if tags are predefined.

**If tags are pre-defined**, they are static. Only new versions of the software would update tags.

**If tags are user-defined**, the user has all the responsibility. Tag migration gets harder.

I propose to provide a number of tags shipped with the application, preserving the ability of the user to define and curate tags.

Now to the more complicated part: **tag migration**. Tags coming from other sources (existing sites or p2p metadata) need to be migrated to the user library. Several things need to be implemented to make this possible:

- **tag aliases**\
  define different names for the same tag (_oppai_ = _big breasts_)
- **migration rules**\
  depending on the complexity of the tagging system (discussed [below](tagging-system.md#possible-features)), different migration rules might be necessary

It might be necessary to define these things separately for each metadata source. Which is pretty much impossible for p2p.

## Possible Features

The following ideas are ordered by increasing complexity. The names for these features are not perfect but the best I could think of. The question for each one is if they have use cases?

### Tag Weight

**Tag weight is how prominent the tag is in the connected work**. This would be on a scale from 0% to 100% (0% excluded, since then the tag shouldn't be there), or (0,1].

- https://nhentai.net/g/205905/
  - _paizuri_, but only on 2 out of 20 pages, resulting in a weight of 0.1
  - _full color_, on every page. So this could be replaced by another tag _colored_ with weight of 1.

The point of tag weights is to enable sorting by relevance when searching for a group of tags. This also opens up advanced search queries if the user would like only results with a tag weight over/under a threshold.

As a work-around for tag weights, the user could just define a tag for each weight range they deem to be different enough to necessitate a distinction when doing a search.

#### Tags per Page/Panel

This is a way to objectively (as possible) quantify the tag weight. Each manga would have a fixed number of taggable units (pages/panels). The user could then define if the tag is present in each unit or not. The weight can then be easily calculated.

The definition of taggable units would have to be done by the user if something more complex than just pages is chosen. With "just pages", the problem is that manga often have cover and end pages which do not contribute to taggable units, in my opinion.

#### Special Case: Multi-Story Manga

Some manga are a collection of multiple stories with each having different tags. In any case, the taggable unit should at least be the story. For single-story manga, the taggable unit would the complete manga if nothing else. Read more in [this document](multi-story-manga.md).

### Tag Relations

Some tags are connected to other tags. This is best explained with some examples.

**Category/Hierarchy**\
If a tag is in a category, then the work is automatically tagged with the category, meaning searchable by it. This could apply to multiple levels.

- _kemonomimi_ ("animal ears") is category for _nekomimi_, _ookamimi_, etc.
- _group_ is a category for _threesome_ is a category for _ffm threesome_

Question: **What about multiple inheritance?** Something like this is thinkable:

- _ear licking_ is part of category _ear play_ and _licking_

**Opposition**\
Tags related this way exclude each other (at least on the same taggable unit). There might also be a required choice between them.

- _monochrome_ | _color_ (one of them should always be present)
- _rape_ | _consent_ (as long as there is sexual interaction, one of them is pretty much required)

In each of these cases, one of the tags could be the default and be omitted if the other is not given. As a work-around, the user could do a query with the non-default tag negated. A problem then arises with tag weight: Assume _monochrome_ is the default and omitted, since a manga can be partly in color and greyscale (and tagged _color_ with a weight), but when the user searches for _not color_ with the intent to find monochrome manga, the manga won't be in the result even though it is partly _monochrome_.

**More Complex Relations**\
Some more complex relations are also thinkable:

- _nakadashi_, by definition, requires at least one penis and one vagina. Which means there should be a tag like _male_/_futanari_ and _female_ present. This would help in warning the user about invalid tag lists but could not directly create tags for the user.
- can you think of more examples?

### Derived Tags from Tagged Character Network

**What do tags define?** In most cases they describe a character or the interaction between characters.

So this feature would not only have pages/panels as taggable units, but make characters taggable as well. Most interaction tags would also need a direction (who dicks down who), although obvious most of the time, and a reference to the actors. Defaults would make curating easier.

Example https://nhentai.net/g/271431/:

- character tags 1: Sumoto-senpai, _female_, _oppai_, _school uniform_, _unusual pupils_
- character tags 2: Fudou-kun, _male_
- interaction tags: _nakadashi_, _blowjob_, _defloration_, _paizuri_
- normal tags: _condom_ (could be character tag of the guy, depending on what that tag is supposed to describe in the user's mind)

This would also enable searches like:

- "I want _virginity_, but only the guy and he has to be a shota."
- "I want _dark skin_, but only the girl, she can have a dick tho."
- "I want an anatomically _female_ _elf_, with _pointy ears_ and in a _maid costume_ who gets her _ear nibbled_ at some point by some other party."

This would also make some other tags purely emergent: _yuri_, _yaoi_, _group_, _vanilla_ (whatever that is for you). The emergence rules for these tags would need to be defined as well.

## Other

- tag description
  - could be curated for pre-defined tags
  - users could use it to remind themselves of what they envisioned with this tag
  - it could even help with p2p, explaining what the peer meant
- pretend tags, should there be some kind of flag or just let the user implement 2 tags for each case?
  - real cat ears vs. a headband
  - maid costume vs. a real maid
  - role-play vs. the real thing

[#1]: ../user-stories.md#1
[#4]: ../user-stories.md#4
[#5]: ../user-stories.md#5
