fork(2) download
  1. fn=
  2. ->s{s.gsub(/j|(?<=^|[^a-z])u|(?<=[a-z])v|(?<=^|[^s])s(?=[a-z])/i){$&.tr"jJsUuVv","iIfVvUu"}}
  3.  
  4. testcases = <<END.lines.map(&:split)
  5. Joy Ioy
  6. joy ioy
  7. Universe Vniuerſe
  8. universe vniuerſe
  9. Success Succeſs
  10. successfull ſucceſsfull
  11. Supervise Superuiſe
  12. supervise ſuperuiſe
  13. Super-vise Super-viſe
  14. I've I've
  15. majors maiors
  16. UNIVERSE VNIUERSE
  17. 0universe 0vniuerſe
  18. 0verify 0verify
  19. I0ve I0ve
  20. _UU_ _VU_
  21. _VV_ _VU_
  22. ss_ ſs_
  23. use vſe
  24. END
  25.  
  26. testcases << ["Christian Reader, I have for thy use collected this small Concordance, with no small labour. For being to comprise much in little roome, I was to make choyse of the most principall and usefull places, and to rank them under such words as I thought most essentiall and materiall in the sentence, because the scant roome allotted unto me, would not permit that I should expresse them under every word in the verse, as it is the manner in large Concordances.", "Chriſtian Reader, I haue for thy vſe collected this ſmall Concordance, with no ſmall labour. For being to compriſe much in little roome, I was to make choyſe of the moſt principall and vſefull places, and to rank them vnder ſuch words as I thought moſt eſsentiall and materiall in the ſentence, becauſe the ſcant roome allotted vnto me, would not permit that I ſhould expreſse them vnder euery word in the verſe, as it is the manner in large Concordances."]
  27.  
  28. testcases.each do |word,exp|
  29. printf "%s -> %s (expected: %s)\n", word, fn[word], exp
  30. end
Success #stdin #stdout 0.06s 9744KB
stdin
Standard input is empty
stdout
Joy -> Ioy (expected: Ioy)
joy -> ioy (expected: ioy)
Universe -> Vniuerfe (expected: Vniuerſe)
universe -> vniuerfe (expected: vniuerſe)
Success -> Succefs (expected: Succeſs)
successfull -> fuccefsfull (expected: ſucceſsfull)
Supervise -> Superuife (expected: Superuiſe)
supervise -> fuperuife (expected: ſuperuiſe)
Super-vise -> Super-vife (expected: Super-viſe)
I've -> I've (expected: I've)
majors -> maiors (expected: maiors)
UNIVERSE -> VNIUERSE (expected: VNIUERSE)
0universe -> 0vniuerfe (expected: 0vniuerſe)
0verify -> 0verify (expected: 0verify)
I0ve -> I0ve (expected: I0ve)
_UU_ -> _VU_ (expected: _VU_)
_VV_ -> _VU_ (expected: _VU_)
ss_ -> fs_ (expected: ſs_)
use -> vfe (expected: vſe)
Christian Reader, I have for thy use collected this small Concordance, with no small labour. For being to comprise much in little roome, I was to make choyse of the most principall and usefull places, and to rank them under such words as I thought most essentiall and materiall in the sentence, because the scant roome allotted unto me, would not permit that I should expresse them under every word in the verse, as it is the manner in large Concordances. -> Chriftian Reader, I haue for thy vfe collected this fmall Concordance, with no fmall labour. For being to comprife much in little roome, I was to make choyfe of the moft principall and vfefull places, and to rank them vnder fuch words as I thought moft efsentiall and materiall in the fentence, becaufe the fcant roome allotted vnto me, would not permit that I fhould exprefse them vnder euery word in the verfe, as it is the manner in large Concordances. (expected: Chriſtian Reader, I haue for thy vſe collected this ſmall Concordance, with no ſmall labour. For being to compriſe much in little roome, I was to make choyſe of the moſt principall and vſefull places, and to rank them vnder ſuch words as I thought moſt eſsentiall and materiall in the ſentence, becauſe the ſcant roome allotted vnto me, would not permit that I ſhould expreſse them vnder euery word in the verſe, as it is the manner in large Concordances.)