olivierkes / manuskript

A open-source tool for writers
http://www.theologeek.ch/manuskript
GNU General Public License v3.0
1.79k stars 236 forks source link

[Feature suggestion] Use symbol to add a reference for a character, place, object in the project #248

Open thoronaug opened 7 years ago

thoronaug commented 7 years ago

Imagine I have created a character in my project named "S. Cooper", and in the world section I have created an object named "Batman Belt" and a place name "Comic Shop".

Then, when writing in editor mode, I can simply use a simbol ("@" for example, like in social media) to establish a reference between that scene and the database object, like in:

And @S. Cooper walked down the stairs to the @Comic Shop and sneaky stole the @Batman Belt (sorry for my English :P)

A drop-down list could appear when you type the symbol showing the objects, places, characters we have in the database. This would automatically link the character or the place with the scene or/and the plot. I think it would be very useful.

Thanks.

olivierkes commented 7 years ago

Try right click > insert reference. Or ctrl+space.

But you cannot do it in editor, only in notes / references, and in characters / world items.

Is that somewhat what you want?

hugo-id commented 7 years ago

Yeah, I'd love that too.

As story progresses, sarah becomes saerah, to saera.

Having that automagically handled would be awesome. Plus it will allow really easy implementation of more OTT analytical tools!

You have word and phrase frequency checker, (which are stupidly awesome) well how about character popularity, scene popularity, etc.

Plus allows for more meaningful interplay between the editor and the char/world/plot concepts. If I decide seara now has blonde hair, not black, having her linked already allows me to open her character file, see all scenes she's in...

Wow, I'm really in the zone with gimp lately.. tweekin Mockup of interface feeding off of the ability to dynamically link our char/world/plot objects. The added info is how often character is referenced in scene, Excerpt, With magenta being their direct name, yellow being nickname, and cyan being key for excerpt break

This has moved on from the original point, but that original request, plus this expanded functionality in characters would be massively useful

Sidenote, you can actually see two characters I imported have underscores in their names because I haven't decided on them yet.

thoronaug commented 6 years ago

@olivierkes I can't find "Insert references" in characters section, but I found it in the world objects and ... yes, that is, more or less, what I mean, but in the editor. Would be very useful if you can insert references as you type and later click on these to see the referenced object. Also for stats or filtering, like "Show me all the plots where S.Cooper appears on" and so on.

@hugo-id idea is also great!.

Thank you.

olivierkes commented 6 years ago

Thanks to both of you.

I can't find "Insert references" in characters section

I've added it a few days ago, if you run from develop it will be there.

Would be very useful if you can insert references as you type and later click on these to see the referenced object. Also for stats or filtering, like "Show me all the plots where S.Cooper appears on" and so on.

For me, this is supposed to happened in the Notes / references section (I explain below why). For example:

image

Here by searching for the Character "Philipp" in the cheat sheet, we can see: what scene he is POV of, and what scenes he is referenced in. (Now this displays only references from scenes I think, not from other items. Should be expanded.)

That is, more or less, what I mean, but in the editor.

And now here are the reasons why I created the Notes / references field instead of doing it automagically in the editor:

  1. How should @Philip be treated when exporting? Should it be replaced by the name? Full name? Part of it? What about nicknames, titles, and so forth?

  2. "Batman belt" could sometimes be called "the belt", "batman's favorite clothing item", "the dark night's belt", and so forth. It seems to me that manually referencing the item/place/character/plot in the reference field allows for more creativity.

What do you think?

I totally agree with you that the reference system could be (and will be) made more powerful. Not sure it has to happen in the editor, though. Convince me :)

Some more thoughts

In @hugo-id's post, it looks like manuskript knows the nickname of the character, how should we do that? (it's a great idea by the way). Like a line where we can enter comma separated nick names?

Even if we keep references out of the editor and in the metadata, it's still a great idea to have in the character tab (or somewhere else, could be in the cheat sheet), a list of all scenes where the character is referenced but also where his name/nicknames/titles are written in the text.

Finally, if you agree with me that references are best kept out of the editor and in the references field (but as I said I'm open to counter arguments), we can still think of a tool like "auto-detect references" that would parse the text of the editor and detect matches (as above: names, nicknames, etc.) and happen those references to the notes/references field. What do you think?

thoronaug commented 6 years ago

Convince me :)

Well, I can't, after your argumentation... XD! Just joking I agree with you. I hadn't thought in the export case or in using various names to refer to the same object/character. And I really understand now why you created the Notes/References field. As you explain, it seems evident to have this field and fill it manually because automátically would be impossible. So, what do you think about this new idea?

Imagine you are in "writing mode". Leaving full screen-focus editor to move the mouse, selecting "Metadata" tab, inserting a new reference and choosing an option from the list would probably distract me and probably frighten muses. Maybe it's my fault getting distracted so easily, but this truly happens to me. We can avoid distraction configuring an almost unused key (say "@" or "#" or "~", doesn't mind) and get the "add reference" list appering while you write. In this case, you can add the references without losing the focus and only when you really want to. The words you type remain unchanged and nothing new is added or removed to/from the exported text. And you won't need to do any extra rereadings to add the references.

So, if you write about the object "Batman belt", you can type Batman picked up his belt#, the listbox appears and you select "Batman bell". Character # dissapears but the reference is inserted, and you can keep writing without losing the focus. [Even the list could be a smartlist and suggest you the more likely object/character based on the word typed before the #. In our case, will suggest the objects which contain in any field the word "belt"] (this is only possible in my imagination, I don't know enough Python (i'm on it) to say if it's easily achievable )

Anyway, I appreciate you hear the suggestions and lose your time answering me. Thank you so much, whatever you decide.

hugo-id commented 6 years ago

I would combine this feature with the one I mentioned here, as they rely and feed off one another. Having the custom tags allows the author to customise and control exactly what data he wishes to handle, and how to interact with it.

I'm not sure why, but every character has a colour. This system is perfect for application with the custom/tags. Every tag has a colour, and that colour (if provided), will overwrite a default link-highlight-colour that is shown while proofing within manuskript.

Par example: UID: 0001 (Set by program) Name: John Family Name: Smith Knighted name [custom tag]: Galadriel

To permanently link to his First name: "@0001:name" To permanently link to his Family name: "@0001:family_name" To permanently link to his knighted name: "@0001:knighted_name"

Handling transposing should be easy, as in IntelliJ, the program automatically replaces the link with the link's text. After typing:

"@0001:knighted_name @0001:family_name",

it immediately becomes,

Galadriel Smith (in a hyperlink-colour to indicate it's a link)

In the raw txt file, it's still "@0001:knighted_name @0001:family_name" the program replaces it at runtime. Any export will simply replace ALL links with the linked text, with no indication it was ever a linked value at all.

I can't see any reason for it work any other way. The only things requiring further thinking would be your actual syntax to reference/create the links. The "@" symbol is pretty universally applicable, but if somebody simply wishes to use an "@" there needs be a way to handle that. Either allow switching "@" with any other symbol (#,$,%) or simply require an "@" be created via a double "@@"

Edit: After breaking down all of the functions of the Character class element, I cannot understand why the "Detailed Info" screen doesn't already work like this. You've already got Key+Value pairs and the UI to match, just needs the backend code to match too!

This is all very much my time dealing with java, so sorry if It's a bit incoherent. It's been a very hectic week (christmas break is coming, :sob: ) I'll be glad to clarify anything that inevitably doesn't make any sense.. which is probably all of it :face_with_head_bandage:

You've also got a few "Issues" that are becoming incredibly interconnected. Would it be worth closing them and starting a single, consolidated thread that's easier to keep on top of? One, Two, Three

olivierkes commented 6 years ago

I think it's useful to have separate topics to discuss, even if they're connected, it allows to clarification in the discussion, and we can link comment from one to another.

Connected to custom-metadata, it makes sense to have in-text references.

The format @ID:NAME should at least be changed to @TYPE:ID:NAME (for example: "@C:0001:name") to distinguish items (characters, plots, etc.).

We could insert them as we do references now: typing CTRL+Space opens a completer that allows to chose the item, then a second completer would open to chose the metadata connected to that specific item.

I don't know if I can easily have some text content in the source, but display a different text. (This is something you could research if you want to get involded, see the QTextEdit documentation as a start). In the meantime, the popup way is not so bad, no?

We can discuss those points, but the other question (custom field) is more important now.

thoronaug commented 6 years ago

I think I've lost something right there. @hugo-id, are you talking about typing @ID:NAME in the editor or in Detailed Info tab?. If you mean the editor, you could't reference a character/object unless you use an item in the character/object tabs. As @olivierkes said, (and using original Batman belt example) what if you want to make a reference to the object simply naming it "the belt", or "the favourite Batman's accesory"? This is limiting the possibilities of this feature. I totally agree with the custom fields template, but it's not what I tried to suggest here, but a useful reference system in the editor.

I like the @TYPE:ID:NAME, so I can be used like : Batman picked up his belt@o:0003(+ :NAME if needed) This will insert a reference to the object number 3, which should be the "Batman Belt" No problem in writing this to a txt file and no problem when exporting : you simply ignore what is after the @ (or @@ whatever)

DonEdwards commented 6 years ago

There's a need to break an assumption. The assumption that any given name is always one person/thing, and a different name is always a different person/thing.

In real life, people routinely have multiple names simultaneously. (John, John Smith, Mister Smith, Uncle John, Goober, Daddy...) Plus, they occasionally change their names. (Mary Girlnextdoor, Mary Smith) AND... names occasionally change their people. (Mrs. Smith divorces her husband, and a year later there's a new Mrs. Smith; Lord Kent dies and his son becomes Lord Kent) The same is true, to a lesser extent, of things other than people.

While any given person/thing needs one base name - probably usually the first full name - it needs to also have a number of other names. And any particular name - even the base name - may be valid only over a certain portion of the story.

drawtheliner commented 4 years ago

I too would be interested in being able to add any existing item (character, object, location etc.) as I type (either via CTRL-space, or better by @typing..), and that link be live in the editor (ie., if I change the name of the item, all occurrences in text reflect that).

Variations (nicknames etc) can be dealt with by an alias list within the item. Same names can be dealt with an (optional) additional qualifier.

For example, let's say I have these 4 items: 1: Name: John; Aliases: JJ, Bulldog 2: Name: Bob; Aliases: Robert, BBKing, John Killer 3: Name: Bulldog; Aliases: Woof 4: Name: John; Qualifier: The other john;

Similarities can be dealt with by having extra info in the autocomplete suggestions. So as I type... @Jo.. → I get these suggestions: John, John (The other john), John Killer (alias of Bob) @Bull... → I get these suggestions: Bulldog, Bulldog (alias of John) Etc...

Makes sense?

(I'm not a programmer, but I realize this would probably affect performance drastically. Especially when selecting root folders, containing several texts, each with several of these "live items". Or would it be possible to avoid that?)

rbb8403 commented 3 years ago

Autocomplete for character names and aliases shouldn't hurt performance too badly. Autocomplete can be pretty efficient nowadays. (See: https://futurice.com/blog/data-structures-for-fast-autocomplete) Also, we're talking about, at most, a thousand or so names and aliases?

I think a good example for the worst-case scenario here is something like Worm. Worm is a million word novel, and it's also a superhero story, so almost every character has the potential for an alias. Even that only has three hundred named characters, major or minor, and twice that if you count the sequel. I actually went out and tested the performance of the most naive implementation possible on a list of Worm's characters, to see what kind of times I was getting for name searches. Even with code looking something like this:

for name in NAMES_LIST:
    if name.startswith(query):
      print(name)

The average search time was about half a millisecond, well below the threshold where a human could notice a delay. It might actually be more expensive to render the results than it is to compute them, both in terms of computing power and in terms of man-hours spent implementing it. This is because searching a list has a worst-case time complexity of O(n), and in this case n is vanishingly small.

I'd definitely recommend implementing this feature, because aliases and titles are a pretty crucial part of the domain. Not just for the sake of writing efficiently, but because it assists in the drafting process (ie. a user might know the title of a character who shows up in the next story arc, but hasn't decided on a given name, or they want to keep track of the nicknames they've given their characters).

TheJackiMonster commented 3 years ago

@rbb8403 Actually you don't need linear complexity if you use a dictionary. Especially for strings like character names a binary search is much more optimal. However something to keep in mind when talking about performance in general:

The average search time was about half a millisecond

It doesn't make much sense to say anything about absolute times in such a discussion because we don't know what the platform was and how much entries were actually compared during search. So this is not applicable to any user with a lower spec laptop and a huge amount of data at the same time.

I agree with the statement that autocompletion shouldn't affect performance to much though. Also we should implement it as optional feature anyway because some people could dislike it (for example in the disturbance-free mode). To improve performance in general we need to refactor a lot of Manuskripts IO code in general (file loading, saving) and adding smarter data access. Currently the whole codebase works for the most part but in a very naive way which requires a more powerful system to run than intended.

obw commented 3 years ago

I think I have one of the biggest projects which are actually worked on with Manuskript. Half a million words and about 100 Characters. This feature would really help me.

The issue with the performance is not to underestimate, my system (AMD 4Core 2GHz and 16 Gb RAM RAID5 Storage, only about 20% faster on my Lap which is a little newer (Intel 8Core 2,5GHz and also 16Gb RAM)) need more than 90 seconds to open this thing, and sometimes more than a half minute to switch between scenes or chapters.

Also, it would be Ideal when not only characters would be autocompleted, "World Items" would also nice when in the autocompletion.