Wordsmith will look at your data (either via upload or the API), and determine whether the data is a Number, Text, List, Date, Time, DateTime, or True/False. These distinctions affect the formatting options you have for that data and the functions you're able to use in Branches, so it's important that they are categorized correctly.
You can change how all of your data is classified by visiting the Data tab in a Template and clicking "Edit Data Types." Once you've done that you'll be taken to the page below, where you can change the data type in the middle column. When you're done, click "Save Types", and open up your Template again. The data type should be updated and you'll have different formatting and function options available.
You can also get there from the Project page using the dropdown list next to the name of your CSV file.
If you're using the Wordsmith Tableau integration, you can change the data types of each Data Variable in a calc on the Calculate page. Open up the calc, and you'll see an icon next to each column header in the table indicating the type of data. If you want to change it, click on the arrow next to the column header and select 'Change calc output type'. You'll see a drop-down of all the data types. Changing the data type will change the formatting options you see when inserting that Data Variable into your Template and the operators you can use in your Branches.
Wordsmith gives you a lot of formatting options for numbers. And as you select the different options in the drop-down list, you'll see the displayed number update based on what you choose.
- Choose the number of decimal places.
- Include or exclude commas.
- Write an ordinal number.
- Convert to an absolute value in case you have any negative values in your CSV file (like percent change).
- Multiply by 100, especially useful for decimal values in your CSV that you want to be represented as a percentage in your content.
- Put parentheses around negative numbers.
- Insert a plus symbol (+) in front of the number.
- Write out numbers as text if they're under 10 (i.e. one, two, three). And choose how you want that text capitalized.
- Write out all numbers as text (i.e. one, two, ten, fifty). And choose how you want that text capitalized.
- If you have large numbers in your data (millions, billions, trillions), you can shorten them to 5 billion. You can even choose the number of decimals displayed for those shortened numbers.
If you choose to include decimal places, you'll have the option to strip trailing zeros.
Combine formatting options to display your numbers exactly how you want to. For example, adding ordinal ending and writing out number less than 10 will mean your numbers are written as first, second, third, etc. all the way up to ninth.
When using numbers in conditions, you can use all of the comparison and math operators: greater than, less than, equal to, plus adding, subtracting, etc.
You can change the capitalization for data that is text. Use this tool as a way to normalize any data you might have that isn't all uniformly capitalized. There are currently 5 different ways you can format your text variables:
- Keep as-is: This is the default setting. This will leave your data unchanged.
- First word: This will capitalize the first letter in your data, leaving the rest of the data unchanged.
- Each Word: This will capitalize the first letter of each word in your data.
- EACH LETTER: This will change all letters in your data to uppercase letters.
- no letters: This will change all letters in your data to lowercase letters.
For Text data, you can use operators like equals and does not equals for an exact match, or includes and excludes for a partial match.
A list is a series of values separated by a comma within one cell of your CSV file or one data value passed to the Wordsmith API.
You can choose how you want to capitalize the text or display the numbers in a list, how you want to separate the items, and even what items to write.
Choose how you want to group the values in the list by selecting the conjunction 'and' or 'or', or if you don't want to include a conjunction, select 'none'. You can also choose to include an oxford comma.
You have control over how you want to write the values in the list - you can pull out individual values by their order and even re-sort the order.
- None: Values in the list remain unchanged from how they are in the data.
- First: Choose the number of values you want inserted in the Template starting at the beginning of the list. Selecting First 1 Item will write just the first value in the list, selecting First 2 Items will write the first and the second values in the list, and so on.
- Last: Choose the num of values you want inserted in the Template starting at the end of the list.
- Nth: Choose one specific value by its order in the list. If you wanted to just insert the second value in a list, you would select Nth 2nd Item.
- Sort: Re-order the values in the list regardless of their order in the data. You can sort Ascending or Descending and then choose None, First, Last, or Nth based on that new order. Sorting will work for text and number values within a list.
If the items in the list are text, you can choose the casing. For example, if you're starting a sentence with a list Data Variable, you may want to set the letter casing as 'Capitalize first letter'.
Some formatting options will also allow you to format the conjunction.
If the items in the list are numbers, you'll see all of the available number formatting options, like setting the decimal places.
You can use all of the same operators for lists that you can with text, plus the includes and excludes functions.
Wordsmith recognizes the most common date formats from Excel and Google Sheets (MM/DD/YY or MM/DD/YYYY) that are uploaded to the Wordsmith Project or passed via the API.
There are a lot of formatting options available for dates, but if you don't see the specific way you want to represent your data, try inserting the Data Variable twice and formatting each one differently.
You can use Get functions to pull out one part of a date (like the day of the week), Between functions to compare the time between two dates, and the Ahead/Ago functions to add or take away time from a date.
In addition to dates, Wordsmith can recognize units of time as well. Wordsmith can support time up to the seconds unit in both 12 and 24 hour formats (10:59 PM or 22:59).
And you can reformat your Time data to look like any of these options when written in your narratives.
You can compare Time Data Variables to each other or to a new value. When comparing to a new value, make sure to put the value in quotes.
Or you could compare two time variables to each other.
Along with Dates and Times, Wordsmith also recognizes DateTimes. DateTimes can be formatted just like Dates and Times.
Just like with Dates, you can us you can use Get functions to pull out one part of a date, like the day of the week, with DateTimes. Between functions to compare the time between two dates (i.e. how many days between two dates) and the Ahead/Ago functions to add or take away time from a date will work with DateTimes.
Timestamps in your data will be automatically recognized as a DateTimes in Wordsmith.
In addition to standard formatting for Date, Times and DateTimes shown in the sections above, Wordsmith provides you the ability toggle on or off custom formatting for all 3 of these data types. Custom Dates, Times, and DateTimes allow you the highest possible level of customization for your detailed Dates, Times, and DateTimes data.
Custom formatting uses strings of tokens and then replaces them with the corresponding values. Here is an example using 01/01/98 23:59:59 as a DateTimes data variable:
|Month||M||1 2 ... 11 12|
|Mo||1st 2nd ... 11th 12th|
|MM||01 02 ... 11 12|
|MMM||Jan Feb ... Nov Dec|
|MMMM||January February ... November December|
|Quarter||Q||1 2 3 4|
|Qo||1st 2nd 3rd 4th|
|Day of Month||D||1 2 ... 30 31|
|Do||1st 2nd ... 30th 31st|
|DD||01 02 ... 30 31|
|Day of Year||DDD||1 2 ... 364 365|
|DDDo||1st 2nd ... 364th 365th|
|DDDD||001 002 ... 364 365|
|Day of Week||d||0 1 ... 5 6|
|do||0th 1st ... 5th 6th|
|dd||Su Mo ... Fr Sa|
|ddd||Sun Mon ... Fri Sat|
|dddd||Sunday Monday ... Friday Saturday|
|Day of Week (Locale)||e||0 1 ... 5 6|
|Day of Week (ISO)||E||1 2 ... 6 7|
|Week of Year||w||1 2 ... 52 53|
|wo||1st 2nd ... 52nd 53rd|
|ww||01 02 ... 52 53|
|Week of Year (ISO)||W||1 2 ... 52 53|
|Wo||1st 2nd ... 52nd 53rd|
|WW||01 02 ... 52 53|
|Year||YY||70 71 ... 29 30|
|YYYY||1970 1971 ... 2029 2030|
|Y||1970 1971 ... 9999 +10000 +10001|
|Week Year||gg||70 71 ... 29 30|
|gggg||1970 1971 ... 2029 2030|
|Week Year (ISO)||GG||70 71 ... 29 30|
|GGGG||1970 1971 ... 2029 2030|
|Hour||H||0 1 ... 22 23|
|HH||00 01 ... 22 23|
|h||1 2 ... 11 12|
|hh||01 02 ... 11 12|
|k||1 2 ... 23 24|
|kk||01 02 ... 23 24|
|Minute||m||0 1 ... 58 59|
|mm||00 01 ... 58 59|
|Second||s||0 1 ... 58 59|
|ss||00 01 ... 58 59|
|Fractional Second||S||0 1 ... 8 9|
|SS||00 01 ... 98 99|
|SSS||000 001 ... 998 999|
|SSSS ... SSSSSSSSS||000[0..] 001[0..] ... 998[0..] 999[0..]|
True/False data, also called Booleans, is a type of data with only two options: True or False. Wordsmith will recognize data as True/False if all of the data for that Data Variable is either "true" or "false", "t" or "f", "yes" or "no", or "y" or "n".
An example of True/False data could be features of a product. Below is product data for different TVs. Wordsmith will recognize the wifi_capable Data Variable as True/False data. Y/n and yes/no are also recognized as True/False data, so smart_tv and hdmi_port would be True/False data types, as well.
You probably won't need to format True/False data, and will more likely be using it in Branches. Using the data in the example above, the Branch rules would be "wifi_capable = true", "smart_tv = true", or "hdmi_port = true".
Even if your data doesn't include "true" and "false", Wordsmith will recognize any "true" as TRUE. So "yes" is TRUE, "y" is TRUE, and "t" is TRUE. And the alternative works for "false": "no" is FALSE, "n" is FALSE, and "f" is FALSE. Because of that, you can use any of the functions below in your Branch and they will all mean the same thing.
If you would like to use false as a branch option, you would write "= false" in the Branch rule.
Updated over 2 years ago