Okay, afternoon everybody, as this part of the slide says, my name is Steve and as this
part of the slide says I'm a bit of a geek.
If we've all turned up to the correct deaf loom, this is to talk about grammar.
Yeah, I should probably tell you from my accent, I'm English, anyone else here from England?
Welcome to Europe.
I hope you're in the course of the next 15, 20 minutes.
I'm really talking about this little random block of code that attends to turn normal English
into grammatically correct English.
And I know the joke is that they know there's British English and there's wrong.
That's not directed towards the Americans, that's just fact.
So I'm going to be talking about the origins of this little project.
It's all up and get hub slides at the end.
The problem I was trying to solve and the solutions that I adopted to solve that problem.
It will be focused on some of the earlier stuff, but I should probably do who am I?
What have I done to deserve a place on this stage?
Or is the slides should be called the ego slide?
This is where the speaker blides about themselves for 10 minutes.
Well, everyone else thinks, can I get to the other deaf room I wanted to go to?
Well, basically, I'm a geek.
I've written some books, I write some music and someone recognized me as a magician earlier.
I was doing it on the main stage a couple of years ago in the magic show.
Does anyone see me do stuff at first and then before?
And you came back?
You're blabbering, I thought.
So I've done a whole lot of crap, but the important thing is what's not on this slide.
Yes, I've made games and but I'm not a translator, my English is awful.
That's why I have editors to sort my books out for me.
This is all about, well, if I can do this, anyone can.
It should not be beyond the width of human beings to do just decent language.
So this project started in about 2018, 2017 with that thing.
Alexa, I was at a JavaScript meeting because JavaScript is the one true language.
And no one's picked me up on that, okay, that's a different pattern all.
No one's picked me up on that, okay, that's a different pattern all.
Okay, so I thought, okay, I'll get one, I'll mess around with it.
I went to various meetups, I wrote a lot of Alexa skills.
And I found this was really interesting.
I could harness a very complex technology into some very, very simple JavaScript.
I thought, I liked that.
And voice-in-touching, I thought, I like that.
And voice-in-touching, I thought, I was very interesting topic.
Most of the time we have a screen with text on it, we can refer back to the text, if we forget.
With the voice-in-touching, you can't.
It plays, the voice ends.
And you've got to remember everything that was said.
I thought that was quite intriguing.
So I started playing around with this, I wrote things that would tell you what they,
the bins are taken out.
Do you, everyone can remember what day they've got to take the bins out?
No.
Well, I don't need to either, because the person next to me,
they take their bins out the day before, and I can see them.
They are quite literally a bin fluencer.
OK, never mind.
So I thought, OK, I can do this JavaScript thing,
and I'll do it as a service, because everything is as a service.
You know, it's set software, as a service.
You know, oh, Cracky.
Anyone actually like AI here?
Am I allowed to harass about AI in this room?
Yes.
Good.
OK.
I like Cracky as a service.
It's like, oh, OK.
Everything's as a service.
I thought, OK, great.
Well, this is a service thing.
You make an API call.
It fixes your grammar.
It spits out the correct grammar.
And this would do it in both English and as a speech thing.
And that was an intentional choice.
Because speech is different to words.
And there were a lot of subtle things in speech
that we just don't generally acknowledge.
And hopefully, I'm going to come through some of them.
And in 2025, that's last year.
I know it feels like a lifetime ago, but it's only 30 odd days.
And I thought, well, I'd written this thing for Alexa.
Amazon said, hey, we really like this idea of this grammar
as a service thing.
We would like to promote you on our blog.
OK.
Are you paying me money?
No, no, no.
But we'll put a mention on our blog.
No, I'm open-sourcing it.
There's no money involved.
It's open-sourcing.
So I open-sourcing a whole lot last year.
It's been used in a number of things.
I don't know whether it's useful to anyone else except me.
Because I get annoyed by a lot of bad, groundbreaking things.
And that's someone who's not very good at English themselves.
You know, my second language is drunkenese.
You know, things like that says you have one email open-backed S.
Isn't that just lazy?
That should not be, I think.
You pick up a axe.
It's an axe.
Look at it.
Are we looking at a vowel here?
Is this a vowel sound?
And again, I mention it comes from Alexa.
Comes from voice interfaces.
What's this word, by the way?
What's this?
Oh, now you know there's a trick, don't you?
Yeah, that's not AI.
That's, ah.
That's a free-toed slice.
It's a perfectly valid word in scrabble.
You can get up to 35 points with that word, but it's not AI.
And if you throw that into a speaks synthesizer, it gets it wrong every time.
So you need somewhere you're actually fixing just normal plain text
when it goes out to the other end.
What do you think happens when you feed this thing in?
It is 30 minutes past five.
No, it's not 30.
That's how we say we say 30.
We don't say 30.
So when it comes out of the speaks thing, that feels very wrong.
Us does Angela Merkel.
Doesn't it great when it says Angela?
That is Angela, but it's not his anger.
So you've got to fix it.
I always like this one.
It's Polish or Polish.
Maybe as a writer, I've just got sloppy and I haven't capitalised it.
When it's a correct form there, you've got to get it and, you know,
what language is this?
It's not C sharp.
It's C hash.
Just the natural way it gets possessor C hash.
But that's okay.
Everyone that programs in this language is, you know, they all wear glasses
because they can't C sharp.
You kick me off the stage already.
I'm going to annoy you with my question.
Is it not C octauthor?
Okay.
It's one of those, is it?
So there's a lot of cases where just the text doesn't quite convey all the information
that it should convey.
So I thought, well, either we can teach everyone to write AI this way.
Or we could kind of kind of fix things.
Because there is a book called The Chicago Manual of Style.
And obviously when I say style, I don't mean dress style.
Clearly, I've got read a book on style.
But the shirt is good.
You like the shirt?
Yes.
If my wife is watching, see, they like the shirt.
Style in this sense means, how do you write proper like?
You know, if you have a number, if it's below 10,
you will actually write out the word for the number.
If it's above 10, you write it out in digits.
These very simple things is apparently quite hard.
And I'm kind of a moderately native speaker of English.
But it is still very difficult to make sure you get all the things right.
So let's pass that off to a computer.
And by a computer, I do not mean AI.
What is the point of spending 14 billion a year on AI
when you can just write 12 lines of JavaScript to do the same thing?
So the solutions are basically, don't create a problem in the first place.
This means everyone that writes code,
this to be fluent in both language and in English.
That's going to be expensive, that's going to be time difficult.
So that's going to be a tricky thing.
We can fix it manually.
We can have a bunch of people just going through all the code,
checking for all the grammar.
Again, expense is not going to happen.
We can ignore the problem.
Most people ignore the problem.
Every now and again, I'll see another piece of software.
I'm going, no, another one.
They're just ignored it.
My attempt is, can we kind of find some way to automate this
so that it doesn't just grind your gears?
So, these are the types of things which the library automate.
So it will look for numbers.
And if there are numbers which is a plural number,
it will make sure there's an S on the end.
And this has been an employee melody for English,
but it's been structured in such a way that any other language
can just be plugged in.
You write a little function that says, is this number a plural?
Yes, no.
Boolean, true false.
At the end of the day, it will then fix it.
Factions.
If you write one slash two,
the screen will say one slash two.
It won't say a half.
But we don't always say one half.
So it will fix that sort of things.
Symbols indefinite articles, the A's and the Anz,
and certainly pronunciation,
is certainly cursed into this as well,
when it could be ambiguous.
So what did he do?
Well, it's JavaScript.
You bring in the library, you say fix it.
Throwing the text, make reference that there's going to be a number there,
and it will just do the work.
These are the different options you don't have to put every option in there.
I want the style formatting.
I want the plowels, but don't do the word number thing.
The number is less than 10, you write it out.
Sometimes that's not always what you want,
so everything is switch on it lovable.
Which can be fun.
And then it looks like this, yes, it wraps around a bit.
But all the code does is, things in a sentence,
splits it up, looks at everything in there, and goes,
okay, I'm going to process every single word in this sentence.
I'm going to fix it up.
And it's done in this way, so that you can add additional processes.
So if your language is not English, and it has things which are not one of these five,
it just sorts it out for you.
So I'm using a number of other people's libraries,
because I'm far too lazy to write my own.
The pluralized library is really handy.
You know the plowel of sheep.
It's sheep.
The plowel of person is people.
This is not sticking us on the end.
English has been such an annoying language,
but it's everything has got an exception somewhere.
And I'm sure I'm not the only one that gets annoyed by that.
So there are other libraries, luckily out there that do this stuff.
There's libraries that convert digits into actual numbers,
spoken words, numbers into words, words that actually have silent
h's that then change the ways, an hour or eight on this note,
and on this person.
Ooh, which I think I'm roughly almost getting now.
And all the initialisms.
All of this stuff, a normal speech synthesizer thing,
is just going to look at that and go,
A, C, or A, or A,
is probably not going to do what you mean it to.
And the fun one, all the capitalisms.
These words change their meaning,
whether this is a capital or not.
So in lower case, it's August.
A capital A is August.
Completely different word.
Polish we did earlier, Polish and Polish,
and Job and Job again.
I had a copy of these from Wikipedia.
I'm not that smart.
These are the sort of things that you just have to worry about,
particularly with voice interfaces.
And if you're thinking, well, I'm never going to do a voice
interface thing ever in my life.
So like, well, why not?
At some point, we have people who just can't lead the screen.
I am now getting to that age where I can't see the screen as well
as I used to when I was a younger person.
I was going to say a younger person.
I think I've ever been young in my life.
I was born old.
But I'm getting to the point.
It's like, I need these helping.
I need the device to say things to me if I can't lead the screen.
So at some point, screen readers are going to become much more prevalent,
especially as our generation of people get older.
And we suddenly realize,
damn, I actually do need screen readers now.
So these sort of things are going to become my think more permanent.
So as an example, what is that?
That's a fup agent.
Because, I mean, how many, I'm not going to test anybody.
There's no quiz at the end of this.
The quiz was last night.
Was anyone there for the quiz last night?
No?
Well, you should have been there.
It was brilliant.
We gave out free beer to everyone.
You missed it.
Sorry.
It was me again, yeah.
So there were about four problems with that sentence.
And if you flow it into the library, it fixes it.
That's the correct output.
It's not a, it's an, because it's f.
And that's a vowel sound.
It's a capital A.
And it has to have a full stop at the end.
And FPI agent.
And this is the SSML, which is the speech version of it.
So it will actually spell out FPI.
This stuff is really quite handy.
And look at teach me.
This is either the most useful thing of the library,
or the most pretentious.
I put a bit in the library that man explains to you where you went wrong.
FPI is an initialism, not an acronym.
A initialism.
There's a difference.
And should be written with dots like this.
And it uses the example in the output as well.
So it kind of handles itself as a teaching tool for everyone else.
And it gives it in text, standard plane, HTML along with the SSML.
So that's all good.
One fairly nice example.
The next steps on this, I truly don't know.
I wrote this stuff because I liked it.
I needed it when I was doing Alexa stuff.
I needed the library.
Well, now I don't do Alexa stuff anymore.
Do I still need the library?
I don't know.
I think it's an interesting problem.
I think it's a worthwhile problem to look at.
So I'm here to sort of say, look, is this fun?
Is this interesting?
Is this even useful?
If not, yeah, we have a nice time.
So if it's useful, it's great if not.
Fine.
There's a number to do in the code.
When I wrote this, because it wasn't written as open source,
some of the code is a bit crap.
When I open source this, I suddenly realize that I felt the word sentence incorrectly.
You know how bad it is when you're writing a piece of software that does language and grammar correction
and you've misspelled the most used word in your product.
So I had to fix a spelling of sentence.
And a few other things.
There's a few other bits there.
It's only JavaScript because it was written as a service.
But there's no reason why you can't just copy and paste this stuff and just change a few bits
to make it work elsewhere.
And of course, there's Job's job.
Is anyone aware of this?
Oh, this is either going to really entertain you or bore you senseless.
This is from Richard Lederer's word circus.
I don't know if anyone's ever read this, probably not.
But in August, an August Patriot was reading an ad in Reading, Massachusetts.
Long-suffering Job secured a job to polish piles of Polish brass.
You try getting a machine to correctly read that.
I would like to be able to have libraries that could take that and go, oh yeah, I know what to do with that.
And don't say AIs a solution.
AIs never the solution.
I think nice confined pieces of code that just do one job.
The proper Unix way might actually help.
So I would like to be able to get that read perfectly.
And the code almost gets it right.
Without doing any special work, it gets most of that right.
Because it understands the initialism, Polish and Job and Job and Reading,
versus Reading.
That one, that's really good fun.
Because I'm from England, there is a town called Reading, not far from me.
And I love just going there and just saying, well, you know, you people,
there's a very sharp decline in the standard of reading.
Okay, for the three people, it was worth it.
So my conclusion is, groundwork is actually really quite hard.
When you look at what's going on underneath the language, there are problems there.
So it's not surprising.
We just kind of forget about it and we push it and we just, oh, someone will fix it later.
Let's see if we can fix it now. Let's get it right.
It's definitely hard with dynamic content.
Anytime there's dynamic content in there, go over.
You've got to start thinking about this.
And it's not just about the code, it's about the language underneath it.
I try and think voice first.
I like the idea the computer is talking to me.
The voice is what's coming to me, not the text.
So I think, okay, is there a way of understanding what's being said here on screen?
And could we get this to other languages?
You know, I am very fully British.
I speak, which almost know what the language is.
My French is bad, my German is bad, my Japanese is awful.
So I am very much the stereotypical English guy.
So I would love to see this in other languages.
And there's no reason why not.
It's built in such a way that it can be ported.
So with that in mind, I can do any questions that anyone has.
I will update my scorecard.
There we go.
30th talk.
I've given this conference over 26 years.
I'll buy and does it show.
But otherwise, that's all for me.
I can take questions.
Thank you.
Good night.
I have a question, can we?
Or a point that might be either very funny or not.
When you show me the explanation, I think there is something you don't.
Yeah, if I want?
Yeah.
On the end of teaching me, there is FBI.
On the, or yes, there, okay.
Okay, submit a PR.
We'll fix it in the next version.
Okay.
It's supposed to jump in now.
I'm sorry.
Okay.
So real question.
Comment first.
Then the question that that was a context leads to.
I work with non-anglophone people writing.
Anglophone comments in code.
How extensive could this grammar as a service solution be made to correct languages made by non-native speakers?
Can I see there are a series of corrections.
But I don't know how many corrections you could make.
Yeah.
There's no reason that depending on your.
So the question is about.
See what I did there.
So the question is about coders who are non-native speakers and how they could fix it while
they're coding.
And they answer his well, why not?
There's no reason you couldn't have this service running either on your local machine.
It's very, very lightweight.
It's JavaScript.
A couple hundred lines.
You can just have that running and your editor can just say, okay, here's the code.
What do you think of it?
And then it can throw back a fixed grammar version for you while you're still there.
It's something you'd have to set up.
But there's no reason why it couldn't.
You know, it was built to be an API.
So yes, go for it.
You had a question.
I think you as well.
And there's another one on here.
A real one.
Really?
Yeah.
Good.
Well, there's this thing.
We have in a weblight called Intermediate Language.
It's usually used that you have a lot of, well, mostly all of the software is written in English.
No matter that nobody is English native.
And even English native.
Well, even British people are messing the grammar as you know.
Yeah.
So mostly it's used as developer English, meaning that you have, before you let
translate this all machines to do the translation.
You use Intermediate, developer English.
So you as writer of the code can do something that's very understandable.
Then that's translated by reviewers to English.
That's used as a source for all the translations.
And we have, or Weblight has plenty of machine translation and machines integrated to do
machine translation general.
But probably this could be very specific.
And we should talk to each other.
Because do you think that you would like to modify this a little bit to be a provider for
machine translation from English to good English form?
Why not?
So the question is, use this elsewhere.
And the answer is, why not?
I don't know what the solution is here.
As I don't think English is the one and true language.
But unfortunately it has become the effect of language of the planet.
So if we can at least use decent English, wherever it's being used, then yeah.
I'll try and I'll hack change and mess around with this as much as necessary.
So get good stuff out there.
So you know, let's face it.
I'm an employable.
So I've nothing else to do this week.
So let's see, let's see what's wrong and move fix it.
So we have to get in one scene.
There are those are brought in a sentence.
Because you have to see, I have to you have to get in one scene.
But a gentleman of Dutch people translating laterally is,
you have one scene for get in.
So I've gone vastly in Chinese.
It's more, more completely conversely,
inversely, on the wall in the same place.
So it is.
Yeah, Germany's time-manor places in order.
You've got to get that right.
Yeah, I remember that for my coordinates.
You had a question still.
Yeah.
You were talking about screenwriters.
Yeah.
You can't necessarily go back and read something because it's voice.
So there's a, I don't really know the tech dialects or screenwriters,
but it doesn't serve us to break up one of the sentences.
So does the library break up the sentence?
Not really, it takes the whole thing in.
It looks at everything.
Try to apply some context to that sentence and go,
okay, I'm now changing the whole thing.
So it wouldn't currently be a lot of use in a live translation environment,
but it could be used if you said, well,
let's just look at the next comma, pass that to the library,
get that to fix it and then do the next bit.
So it is hackable in that way and it's,
and when you've got that sort of library,
it's up to you what you feed it.
So you could just say, well, I'll give you the 10 words I've got,
and then maybe it will make something good after it.
Yeah, something I actually have, I forgot,
I was giving a talk about Eliza, the AI chatbot Eliza,
just prior to this.
And I forgot to mention that Eliza,
if you have one heard of Eliza,
the AI chatbot from 60 years ago,
yeah, well, that doesn't process the whole sentence.
It stops at the first comma,
all the first word, but.
And it just does the bit before,
and ignores the rest of it.
It's like when you send an email to your boss
and they only ask the first question on your list,
that's what it does.
So you could have dropped that mechanism
and just say, well, I'm just going to look for a comma,
send that off, get that fixed.
That career solution.
I saw another hand wave, yes.
You were talking about, like,
attracting, which, like, written, which is correct,
but I want to understand how you would have
to be Lord words, which English uses,
like, English is not, like,
consolidated if you knew you came and now.
And there are a lot of Lord words, like,
we understand, like, Hasbro,
but who I know that, which are using English
and which are kind of used in legal terms,
but these days, how would you use it?
So the library does have some loan words in it.
So the idea of how do we handle loan words,
they are quite literally hard-coded in there.
And I'm saying, these are the ones you need to pay
special attention to, but it's not complete.
So hopefully over time that will grow,
maybe it's the case of splitting out the library.
So we have one library that says,
okay, I'm going to do all the numbers
to words calculation.
I'm going to do all the pluralization,
this library will do loan words.
Maybe that's the way it goes.
Maybe this project just has to go away,
so that the other libraries take care of the big bulk of loan words.
Because as you say, English is quite literally all loan words.
I don't know, I don't know how many words in English
are actually English words anymore.
You know, not to misquote George W. Bush,
but the fans have no word for entrepreneur.
That kind of thing.
We have literally stolen everything.
That's why the British Museum has got some really good
Elgin marbles in it.
Okay, I'm not being allowed back in the British library.
Am I?
Okay, any other questions?
I know I've got about two minutes left to come
to my timekeeper at the front.
No?
All in which case?
Thank you all again.
Good night.
Thank you.