Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.Net: Add new token counter implementations to TextChunker (#2840)
Implement MicrosoftML and DeepDev token counters in the TextChunker example. Update the project file with new package references and modify the RunExampleWithCustomTokenCounter method to support different token counter types. Inspired by #2809 Fixes #478 | Iteration | MicrosoftML (ms) | MicrosoftMLRoberta (ms) | SharpToken (ms) | DeepDev (ms) | |------------|-------------------|--------------------------|-----------------|--------------| | 1 | 38 | 10,189 | 14,305 | 16,701 | | 2 | 36 | 5,581 | 8,381 | 14,214 | | 3 | 13 | 5,354 | 7,955 | 13,630 | | 4 | 27 | 5,679 | 9,156 | 16,164 | | 5 | 16 | 5,158 | 8,657 | 17,276 | | Average | 26.0 | 7,512.2 | 9,710.8 | 15,597 | ### SharpToken <sup style="font-size: smaller;">(Avg. Execution Time: 9,710.8 ms)</sup> ``` The city of Venice, located in the northeastern part of Italy, is renowned for its unique geographical features. Built on more than 100 small islands in a lagoon in the Adriatic Sea, it has no roads, just canals including the Grand Canal thoroughfare lined with Renaissance and Gothic palaces. The central square, Piazza San Marco, contains St. Mark's Basilica, which is tiled with Byzantine mosaics, and the Campanile bell tower offering views of the city's red roofs. ------------------------ The Amazon Rainforest, also known as Amazonia, is a moist broadleaf tropical rainforest in the Amazon biome that covers most of the Amazon basin of South America. This basin encompasses 7 million square kilometers, of which 5.5 million square kilometers are covered by the rainforest. This region includes territory belonging to nine nations and 3.4 million square kilometers of uncontacted tribes. The Amazon represents over half of the planet's remaining rainforests and comprises the largest and most biodiverse tract of tropical rainforest in the world. ------------------------ The Great Barrier Reef is the world's largest coral reef system composed of over 2,900 individual reefs and 900 islands stretching for over 2,300 kilometers over an area of approximately 344,400 square kilometers. The reef is located in the Coral Sea, off the coast of Queensland, Australia. The Great Barrier Reef can be seen from outer space and is the world's biggest single structure made by living organisms. This reef structure is composed of and built by billions of tiny organisms, known as coral polyps. ``` ### MicrosoftML <sup style="font-size: smaller;">(Avg. Execution Time: 26.0 ms)</sup> ``` The city of Venice, located in the northeastern part of Italy, is renowned for its unique geographical features. Built on more than 100 small ------------------------ islands in a lagoon in the Adriatic Sea, it has no roads, just canals including the Grand Canal thoroughfare lined with Renaissance and ------------------------ Gothic palaces. The central square, Piazza San Marco, contains St. Mark's Basilica, which is tiled with Byzantine mosaics, ------------------------ and the Campanile bell tower offering views of the city's red roofs. The Amazon Rainforest, also known as Amazonia, ------------------------ is a moist broadleaf tropical rainforest in the Amazon biome that covers most of the Amazon basin of South America. This basin encompasses 7 ------------------------ million square kilometers, of which 5. 5 million square kilometers are covered by the rainforest. This region includes territory ------------------------ belonging to nine nations and 3. 4 million square kilometers of uncontacted tribes. The Amazon represents over ------------------------ half of the planet's remaining rainforests and comprises the largest and most biodiverse tract of tropical rainforest in the world. ------------------------ The Great Barrier Reef is the world's largest coral reef system composed of over 2, 900 individual reefs and 900 islands ------------------------ stretching for over 2, 300 kilometers over an area of approximately 344, 400 square kilometers. The reef is located in the ------------------------ Coral Sea, off the coast of Queensland, Australia. The Great Barrier Reef can be seen from outer space and is the world's ------------------------ biggest single structure made by living organisms. This reef structure is composed of and built by billions of tiny organisms, known as coral polyps. ``` ### MicrosoftMLRoberta <sup style="font-size: smaller;">(Avg. Execution Time: 7,512.2 ms)</sup> ``` The city of Venice, located in the northeastern part of Italy, is renowned for its unique geographical features. Built on more than 100 small islands in a lagoon in the Adriatic Sea, it has no roads, just canals including the Grand Canal thoroughfare lined with Renaissance and Gothic palaces. The central square, Piazza San Marco, contains St. Mark's Basilica, which is tiled with Byzantine mosaics, and the Campanile bell tower offering views of the city's red roofs. ------------------------ The Amazon Rainforest, also known as Amazonia, is a moist broadleaf tropical rainforest in the Amazon biome that covers most of the Amazon basin of South America. This basin encompasses 7 million square kilometers, of which 5.5 million square kilometers are covered by the rainforest. This region includes territory belonging to nine nations and 3.4 million square kilometers of uncontacted tribes. The Amazon represents over half of the planet's remaining rainforests and comprises the largest and most biodiverse tract of tropical rainforest in the world. ------------------------ The Great Barrier Reef is the world's largest coral reef system composed of over 2,900 individual reefs and 900 islands stretching for over 2,300 kilometers over an area of approximately 344,400 square kilometers. The reef is located in the Coral Sea, off the coast of Queensland, Australia. The Great Barrier Reef can be seen from outer space and is the world's biggest single structure made by living organisms. This reef structure is composed of and built by billions of tiny organisms, known as coral polyps. ``` ### DeepDev <sup style="font-size: smaller;">(Avg. Execution Time: 15,597 ms)</sup> ``` The city of Venice, located in the northeastern part of Italy, is renowned for its unique geographical features. Built on more than 100 small islands in a lagoon in the Adriatic Sea, it has no roads, just canals including the Grand Canal thoroughfare lined with Renaissance and Gothic palaces. The central square, Piazza San Marco, contains St. Mark's Basilica, which is tiled with Byzantine mosaics, and the Campanile bell tower offering views of the city's red roofs. ------------------------ The Amazon Rainforest, also known as Amazonia, is a moist broadleaf tropical rainforest in the Amazon biome that covers most of the Amazon basin of South America. This basin encompasses 7 million square kilometers, of which 5.5 million square kilometers are covered by the rainforest. This region includes territory belonging to nine nations and 3.4 million square kilometers of uncontacted tribes. The Amazon represents over half of the planet's remaining rainforests and comprises the largest and most biodiverse tract of tropical rainforest in the world. ------------------------ The Great Barrier Reef is the world's largest coral reef system composed of over 2,900 individual reefs and 900 islands stretching for over 2,300 kilometers over an area of approximately 344,400 square kilometers. The reef is located in the Coral Sea, off the coast of Queensland, Australia. The Great Barrier Reef can be seen from outer space and is the world's biggest single structure made by living organisms. This reef structure is composed of and built by billions of tiny organisms, known as coral polyps. ``` ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
- Loading branch information