Skip to content

Can we see this package contain a very rough estimate on length and general stats? #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chariegg opened this issue Dec 8, 2023 · 4 comments

Comments

@chariegg
Copy link

chariegg commented Dec 8, 2023

It would be very beneficial (and I would really like to see this get implemented to make fountain-mode even more appealing to use since it has built in export now if you have groff installed) to get a very rough estimate on how long the screenplay is and how long dialogue is for each character and each scene. Looking at the source code for betterfountain, which is fountain support for visual studio code, it's commented the general formula it's using to give a guess on average how long it would take for the movie to go by. I'm a terrible programmer and wanted to hear your feedback how this would be implemented.

Now, the formula is this (Hopefully I'm understanding this right): You take how long the sentence is and how many sentences are per character dialogue. The more dialogue and action elements, the longer a scene will be. I'm going to give a ballpark estimate that the average person would say a sentence at normal speed no longer than 3-5 seconds (See attached PDF for a research paper done on average articulation from 14 movies). Take the total time and possibly include word count and add together all the dialogue and action such as monologue into the scene itself. Then you can show statistics breakdown of each scene. The betterfountain extension only truly cares if the scene starts with INT. or EXT. Everything else (Because anything can be a scene heading under fountain) is categorized under other and it also shows if more stuff happened at night or day. Even more using all this, it can show how many total pages based on what you've typed. But I think fountain mode already does that.

Attaching an example snippet of the typescript code, this was what was under 'calculateDialogueDuration' from utils.ts:

export const calculateDialogueDuration = (dialogue:string): number =>{
	var duration = 0;

	//According to this paper: http://www.office.usp.ac.jp/~klinger.w/2010-An-Analysis-of-Articulation-Rates-in-Movies.pdf
	//The average amount of syllables per second in the 14 movies analysed is 5.13994 (0.1945548s/syllable)
	var sanitized = dialogue.replace(/[^\w]/gi, '');
	duration+=((sanitized.length)/3)*0.1945548;
	//duration += syllable(dialogue)*0.1945548;

	//According to a very crude analysis involving watching random movie scenes on youtube and measuring pauses with a stopwatch
	//A comma in the middle of a sentence adds 0.4sec and a full stop/excalmation/question mark adds 0.8 sec.
	var punctuationMatches=dialogue.match(/(\.|\?|\!|\:) |(\, )/g);
	if(punctuationMatches){
		if(punctuationMatches[0]) duration+=0.75*punctuationMatches[0].length;
		if(punctuationMatches[1]) duration+=0.3*punctuationMatches[1].length;
	}
	return duration
}

Apologizes for the large wall of text. I wanted to help make it not confusing about how to tackle this and generally, it would be very helpful to have this included because then one less reason to leave emacs.

You can find betterfountain here and attached is the PDF as mentioned:
AnAnalysisOfArticulationRatesInMovies.pdf

@chariegg
Copy link
Author

I wanted to add as well, I'm in the process of learning a bit of elisp. If you cannot find the time to implement this by yourself, I'll give it a shot.

@rnkn
Copy link
Owner

rnkn commented Dec 12, 2023

Yes a fountain-stats command would probably be good. As discussed in IRC I don't think this should attempt to time the script, but there's plenty of other interesting stats that could be displayed.

@chariegg
Copy link
Author

chariegg commented Dec 12, 2023

I've been making this look far more complex than it really is. Visual Studio Code when it gives you stats presents it in 3 different tabs for the panel. Time Duration, Scene Breakdown, and Character Breakdown. All of this, all of it, can very easily be applied to the KISS (Keep It Simple, Stupid) principle.

If it's an action or dialogue element, it will apply one of two different formulas. Say for dialogue, it uses regex to check if it's a dialogue element and then counts the length of the total dialogue, then divide by 3 and taking the results of that multiply by 0.1945548. I did the following test with just a single sentence and compared it to timing myself speaking it out at a normal length.

echo "It's just been a while. I guess I was getting lulled into thinking I had a normal life." | wc -c
returned back 89 characters including spaces. Then adding in an additional padding for commas, end of sentence such as question mark and in addition: space between words, it gives you the total time for the dialogue. Then taking all that adds it together. It's incredibly simple if I don't make it sound more complex than it really is. The calculated formula I presented for the sentence matched very close to how long the timer reported back me timing myself. I truly think some kind of time feedback that's a very rough estimate can be done. In just a few new functions as well, not writing up complex algorithms.

general-stats

@rnkn
Copy link
Owner

rnkn commented Dec 13, 2023

I don't have much interest in timing a script (beyond the old rule of one page = one minute). There are other stats that could be interesting. A distraction from actual writing, but interesting nonetheless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants