Download feature.js from Omartificial-Intelligence-Space/Kalemat: direct link, hf CLI and curl.
- Browser
- Download file 610 Bytes
-
https://huggingface.co/spaces/Omartificial-Intelligence-Space/Kalemat/resolve/main/feature.js
- Command line
-
hf download hf://spaces/Omartificial-Intelligence-Space/Kalemat/feature.js
-
curl -L -o feature.js https://huggingface.co/spaces/Omartificial-Intelligence-Space/Kalemat/resolve/main/feature.js
610 Bytes
| function create_token_frequency_chart(tokenized_text) { | |
| // Count token frequencies | |
| const token_counts = {}; | |
| for (const token of tokenized_text) { | |
| token_counts[token] = (token_counts[token] || 0) + 1; | |
| } | |
| // Create Plotly chart data | |
| const data = [ | |
| { | |
| x: Object.keys(token_counts), | |
| y: Object.values(token_counts), | |
| type: 'bar', | |
| }, | |
| ]; | |
| // Create chart layout | |
| const layout = { | |
| title: 'Token Frequency', | |
| xaxis: { title: 'Tokens' }, | |
| yaxis: { title: 'Frequency' }, | |
| }; | |
| // Generate and return chart HTML | |
| return Plotly.newPlot('chart-div', data, layout); | |
| } |