words should strip punctuation #78

Closed
opened 2024-06-15 15:44:37 +00:00 by scott · 2 comments
Owner

Right now it just splits on spaces, no removing any punctuation marks

Right now it just splits on spaces, no removing any punctuation marks
scott added this to the 0.2.0 milestone 2024-06-15 15:44:37 +00:00
scott modified the milestone from 0.2.0 to Computer Class 2024-06-15 15:56:19 +00:00
Author
Owner

Add to prelude this Ludus code:

fn strip_punctuation {
 ("{x},{y}") -> strip_punctuation ("{x}{y}")
 ("{x}.{y}") -> strip_punctuation ("{x}{y}")
 ("{x};{y}") -> strip_punctuation ("{x}{y}")
 ("{x}:{y}") -> strip_punctuation ("{x}{y}")
 ("{x}?{y}") -> strip_punctuation ("{x}{y}")
 ("{x}!{y}") -> strip_punctuation ("{x}{y}")
 (x) -> x
}

fn trim_left {
 (" {x}") -> trim_left ("{x}")
 ("\n{x}") -> trim_left ("{x}")
 ("\t{x}") -> trim_left ("{x}")
 (x) -> x
}

fn trim_right {
 ("{x} ") -> trim_right ("{x}")
 ("{x}\n") -> trim_right ("{x}")
 ("{x}\t") -> trim_right ("{x}")
 (x) -> x
}

fn trim (x) -> do x > trim_left > trim_right
Add to prelude this Ludus code: ``` fn strip_punctuation { ("{x},{y}") -> strip_punctuation ("{x}{y}") ("{x}.{y}") -> strip_punctuation ("{x}{y}") ("{x};{y}") -> strip_punctuation ("{x}{y}") ("{x}:{y}") -> strip_punctuation ("{x}{y}") ("{x}?{y}") -> strip_punctuation ("{x}{y}") ("{x}!{y}") -> strip_punctuation ("{x}{y}") (x) -> x } fn trim_left { (" {x}") -> trim_left ("{x}") ("\n{x}") -> trim_left ("{x}") ("\t{x}") -> trim_left ("{x}") (x) -> x } fn trim_right { ("{x} ") -> trim_right ("{x}") ("{x}\n") -> trim_right ("{x}") ("{x}\t") -> trim_right ("{x}") (x) -> x } fn trim (x) -> do x > trim_left > trim_right ```
Author
Owner

Done.

Done.
scott closed this issue 2024-06-16 02:41:20 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: twc/ludus#78
No description provided.