< Back to examples

Spelling and Grammar Check

Given a list of text, it will remove improper capitalization and transform the sentence to Capitalized Text

Input

This is a spell check generator that capitalizes samples of text.

Sample: a new type OF aurora FounD on saturn resolves a planetary mystery
Capitalized Text: A New Type Of Aurora Found On Saturn Resolves A Planetary Mystery
--

Sample: online Shopping is ReSHaping Real-world Cities
Title Case: Online Shopping Is Reshaping Real-World Cities
--

Sample: When you close 100 TAbs AFter Finding THE SoluTion To A BuG
Title Case: When You Close 100 Tabs After Finding The Solution To A Bug
--

Sample: mastering DYNAmIC ProGrammING
Title Case:

Sample Response

Mastering Dynamic Programming

API Request

1import cohere
2co = cohere.Client('{apiKey}')
3response = co.generate(
4  model='base',
5  prompt='This is a spell check generator that capitalizes samples of text.\n\nSample: a new type OF aurora FounD on saturn resolves a planetary mystery\nCapitalized Text: A New Type Of Aurora Found On Saturn Resolves A Planetary Mystery\n--\nSample: online Shopping is ReSHaping Real-world Cities\nTitle Case: Online Shopping Is Reshaping Real-World Cities\n--\nSample: When you close 100 TAbs AFter Finding THE SoluTion To A BuG\nTitle Case: When You Close 100 Tabs After Finding The Solution To A Bug\n--\nSample: mastering DYNAmIC ProGrammING\nTitle Case:',
6  max_tokens=50,
7  temperature=0.3,
8  k=0,
9  p=0.75,
10  frequency_penalty=0,
11  presence_penalty=0,
12  stop_sequences=["--"],
13  return_likelihoods='NONE')
14print('Prediction: {}'.format(response.generations[0].text))

Parameters

model_sizebase
max_tokens 50
temperature 0.3
k 0
frequency_penalty 0
p 0.75
presence_penalty 0
stop_sequence --