Skip to content

Commit

Permalink
contraction tests for #1074
Browse files Browse the repository at this point in the history
  • Loading branch information
spencermountain committed Jan 5, 2024
1 parent f483252 commit e15e3a6
Show file tree
Hide file tree
Showing 3 changed files with 226 additions and 0 deletions.
1 change: 1 addition & 0 deletions scratch.js
Expand Up @@ -4,6 +4,7 @@ import nlp from './src/three.js'
// nlp.plugin(plg)
// nlp.verbose('tagger')

nlp('one two-three four five').debug()
let arr = [
// 'new york mets',
'new york yankees',
Expand Down
110 changes: 110 additions & 0 deletions tests/two/contractions/did-would.test.js
@@ -0,0 +1,110 @@
import test from 'tape'
import nlp from '../_lib.js'
const here = '[two/did-would] '

This comment has been minimized.

Copy link
@ryancasburn-KAI

ryancasburn-KAI Jan 5, 2024

Contributor

aren't these had-would contractions, not did-would? @spencermountain

Examples with did as the test result make more sense to me as had. She had already finished her work when I arrived, not she did already finished her work when I arrived.

This comment has been minimized.

Copy link
@spencermountain

spencermountain Jan 6, 2024

Author Owner

are you one of those AI coding agents that people are talking about?
Thank you!
Will put in some work on this today, if you'd like to join, just pull on the dev branch first.

This comment has been minimized.

Copy link
@ryancasburn-KAI

ryancasburn-KAI Jan 7, 2024

Contributor

haha no. I've just been procrastinating on the actual work I need to do because this is fun. Unfortunately, the real world has caught up with me, so my time is limited this weekend and next week. cheers!


test('did-would', function (t) {
let arr = [
["He'd love to join us for dinner", 'would'],
["She'd already finished her work when I arrived", 'did'],
["I'd like a cup of coffee, please", 'would'],
["They'd never been to that restaurant before", 'had'],
["We'd appreciate your help with the project", 'would'],
["He'd visited the museum last summer", 'had'],
["I'd seen that movie before", 'had'],
["She'd be happy to help you with your request", 'would'],
["He'd always wanted to learn how to play the piano", 'had'],
["I'd never met someone so talented", 'had'],
["She'd forgotten to bring her umbrella", 'had'],
["They'd finished the task before the deadline", 'had'],
["We'd already made plans for the weekend", 'had'],
["He'd promised to call me later", 'had'],
["I'd never have guessed that he was so skilled", 'would'],
["She'd do anything to make her dream come true", 'would'],
["I'd visited that city once before", 'had'],
["He'd achieved a lot in his career", 'had'],
["She'd always known that it was a risky venture", 'had'],
["I'd seen this movie a long time ago", 'had'],
["They'd never imagined it would turn out like this", 'had'],
["We'd already started working on the project", 'had'],
["He'd promised to help us with the move", 'had'],
["I'd be happy to assist you with your request", 'would'],
["She'd done everything she could to succeed", 'had'],
["He'd said he would come to the party", 'had'],
["I'd never thought of it that way before", 'had'],
["They'd always wanted to travel the world", 'had'],
["She'd been waiting for this moment her whole life", 'had'],
["I'd love to hear your thoughts on this matter", 'would'],
["He'd already finished his meal when I arrived", 'did'],
["I'd seen that painting in a gallery before", 'had'],
["She'd made a mistake in her calculations", 'had'],
["He'd do anything to make her happy", 'would'],
["I'd never experienced anything like that before", 'had'],
["She'd completed the assignment ahead of schedule", 'had'],
["They'd always dreamed of owning a beach house", 'had'],
["I'd be surprised if he didn't show up", 'would'],
["She'd said she would be here by 5 PM", 'had'],
["He'd always known that this day would come", 'had'],
["I'd already made other plans for the weekend", 'had'],
["She'd studied for hours before the exam", 'had'],
["I'd never seen such a beautiful sunset", 'had'],
["He'd never let us down before", 'had'],
["She'd do anything for her family", 'would'],
["I'd been there once before", 'had'],
["They'd finished the race in record time", 'had'],
["He'd already seen the movie", 'had'],
["She'd always wanted to learn how to dance", 'had'],
["I'd be surprised if they didn't win", 'would'],
["They'd never tried sushi before", 'had'],
["We'd love to have you at the party", 'would'],
["He'd promised to help with the move", 'had'],
["She'd finished her work by noon", 'had'],
["I'd never thought of it that way", 'had'],
["We'd be happy to assist you", 'would'],
["He'd already decided on a career path", 'had'],
["She'd always known it was a risky investment", 'had'],
["They'd never been to that part of the city before", 'had'],
["I'd seen that play performed live", 'had'],
["He'd said he'd come to the event", 'had'],
["She'd always wanted to travel to Asia", 'had'],
["I'd be surprised if he didn't show up", 'would'],
["They'd completed the project ahead of schedule", 'had'],
["We'd appreciate your feedback", 'would'],
["He'd always dreamed of owning a sports car", 'had'],
["She'd already made dinner when I arrived", 'did'],
["I'd love to visit that museum", 'would'],
["He'd achieved a lot in his career", 'had'],
["I'd never met someone so knowledgeable", 'had'],
["She'd always known she wanted to be a doctor", 'had'],
["They'd never seen anything like it before", 'had'],
["We'd never imagined it would be so challenging", 'had'],
["He'd promised he'd call as soon as he arrived", 'had'],
["I'd always wanted to learn how to play the guitar", 'had'],
["She'd already finished her meal when I got there", 'did'],
["I'd seen that movie a long time ago", 'had'],
["He'd always wanted to start his own business", 'had'],
["She'd be happy to assist you with your request", 'would'],
["They'd completed the task in record time", 'had'],
["We'd love to hear your thoughts on this matter", 'would'],
["He'd do anything to make her happy", 'would'],
["I'd seen that painting in a gallery before", 'had'],
["She'd already made plans for the weekend", 'had'],
["I'd never been to that part of the country before", 'had'],
["They'd always dreamed of living by the ocean", 'had'],
["We'd already started working on the project", 'had'],
["He'd promised to help us with the move", 'had'],
["I'd love to hear more about your experiences", 'would'],
["She'd already decided on a new career path", 'had'],
["They'd never encountered such a challenge before", 'had'],
["We'd appreciate any assistance you can provide", 'would'],
["He'd always known that this day would come", 'had'],
["I'd seen that movie several times before", 'had'],
["She'd always wanted to learn how to cook", 'had'],
["They'd already made plans for the weekend", 'had'],
]

arr.forEach(a => {
let doc = nlp(a[0])
t.equal(doc.has(a[1]), true, here + a[0])
})
t.end()
})
115 changes: 115 additions & 0 deletions tests/two/contractions/is-has.test.js
@@ -0,0 +1,115 @@
import test from 'tape'
import nlp from '../_lib.js'
const here = '[two/is-has] '

test('is-has', function (t) {
let arr = [
["Jamaica's growing rapidly", 'is'],
["John's quickly running", 'is'],
["The cat's asleep on the windowsill", 'is'],
["She's been working all day", 'has'],
["It's a beautiful morning", 'is'],
["The team's won the championship", 'has'],
["He's studying for the exam", 'is'],
["Mary's visited Paris before", 'has'],
["The baby's crying in the crib", 'is'],
["The project's completed on time", 'has'],
["It's not what it seems", 'is'],
["The dog's chasing its tail", 'is'],
["She's never been to Asia", 'has'],
["The car's parked in the driveway", 'is'],
["He's a talented musician", 'is'],
["The book's missing a few pages", 'is'],
["They're convinced he's innocent", 'is'],
["The company's expanding globally", 'is'],
["She's got a lot of friends", 'has'],
["It's your turn to speak", 'is'],
["The movie's already started", 'has'],
["He's always on time", 'is'],
["The software's being updated", 'is'],
["She's reached her goal", 'has'],
["It's not what it used to be", 'is'],
["The plane's just landed", 'has'],
["She's the one who called", 'has'],
["The coffee's too hot", 'is'],
["He's never met her before", 'has'],
["The baby's first steps are exciting", 'is'],
["The assignment's due tomorrow", 'is'],
["She's a talented artist", 'is'],
["The food's ready to be served", 'is'],
["He's the one in charge", 'is'],
["The project's already started", 'has'],
["She's lost her keys again", 'has'],
["The concert's sold out", 'is'],
["He's got a new job", 'has'],
["The cake's been eaten", 'has'],
["She's been a great friend", 'has'],
["It's not as easy as it looks", 'is'],
["The meeting's scheduled for 3 PM", 'is'],
["He's very talented", 'is'],
["The sun's setting", 'is'],
["She's finished her work", 'has'],
["The car's out of gas", 'is'],
["He's feeling much better", 'is'],
["The package's arrived", 'has'],
["She's never seen such a beautiful sunset", 'has'],
["The movie's already started", 'has'],
["He's always been a good friend", 'has'],
["The cat's sleeping on the roof", 'is'],
["She's got a new car", 'has'],
["It's raining outside", 'is'],
["The project's behind schedule", 'is'],
["He's an excellent cook", 'is'],
["The baby's learned to crawl", 'has'],
["She's never tasted sushi before", 'has'],
["The book's missing a few chapters", 'is'],
["It's important to stay focused", 'is'],
["The team's won every game this season", 'has'],
["She's always been a fast learner", 'has'],
["The computer's crashed again", 'has'],
["He's lived here for years", 'has'],
["The store's closed on Sundays", 'is'],
["She's finished her degree", 'has'],
["The concert's starting soon", 'is'],
["He's become a successful entrepreneur", 'has'],
["The cake's already been eaten", 'has'],
["She's excited about the trip", 'is'],
["The train's already left the station", 'has'],
["He's the captain of the team", 'is'],
["The dog's barking in the backyard", 'is'],
["She's always been a good listener", 'has'],
["The package's arrived on time", 'has'],
["He's never seen such a beautiful sunset", 'has'],
["The company's expanding rapidly", 'is'],
["She's been to Europe several times", 'has'],
["The car's parked in the garage", 'is'],
["He's the one who called", 'has'],
["The weather's getting colder", 'is'],
["She's got a talent for singing", 'has'],
["The meeting's been rescheduled", 'has'],
["He's a professional photographer", 'is'],
["The project's almost complete", 'is'],
["She's already finished her homework", 'has'],
["The coffee's too hot to drink", 'is'],
["He's the one in charge", 'is'],
["The sun's shining brightly", 'is'],
["She's never been to Asia", 'has'],
["The concert's sold out", 'is'],
["He's feeling much better", 'is'],
["The plane's just landed", 'has'],
["She's got a lot of experience", 'has'],
["The book's been on the bestseller list", 'has'],
["He's never met her before", 'has'],
["The assignment's due tomorrow", 'is'],
["She's always been a hard worker", 'has'],
["The car's out of gas", 'is'],
["He's a talented musician", 'is'],
["The food's ready to be served", 'is'],
["She's the one who organized the event", 'has'],
]
arr.forEach(a => {
let doc = nlp(a[0])
t.equal(doc.has(a[1]), true, here + a[0])
})
t.end()
})

0 comments on commit e15e3a6

Please sign in to comment.