UWP 大爆炸你个锤子
今天看到 叫我蓝火火 s的 UWP中实现大爆炸效果(一) ,我也来说一下我的app 【小薇自然语言处理】实现的大爆炸技术。
看一下效果先。
我的控件是基于wrappanel的,正如蓝火火说的,这样看来是很整齐,他不喜欢这样的。不过我倒是觉得还行。哈哈
程序员也是众口难调,哈
大爆炸技术主要分为两个大部分:
1. 分词,把句子拆分成单词
2. 显示,将单词显示出来
1. 分词
小薇NLP的分词技术采用了Boson NLP和Tencent AI双重引擎,可以在设置界面自由切换,实时生效/
具体怎么实现的封装和调用,这里就不多做介绍了。有需要的私信联系。
以Boson NLP为例,看一下把服务器返回来的数据解析一下
private async Task OnSegTag() { var resBosonSegTag = await BosonAIHelper.WordSegAndTag(textInput.Text.Trim()); if (resBosonSegTag != null && resBosonSegTag.tag.Count > 0) { for (int i = 0; i <= resBosonSegTag.tag.Count - 1; i++) { NLPWord nlp = new NLPWord { word = resBosonSegTag.word[i], width = resBosonSegTag.word[i].Length * 20, bgcolor = PosTagHelper.GetPosColor_Boson(resBosonSegTag.tag[i]) }; SegTagItems.Add(nlp); } } }
那个width没用,就先搁置哪里了。
word:单词和标点之类的
bgcolor:每一类单词的背景颜色
2. 显示
由于使用了wrappanel,所以就简单了许多。
只需要自定义一下模板即可。
<Page.Resources> <DataTemplate x:Key="WordsTemplate"> <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{Binding bgcolor}"> <TextBlock Text="{Binding word}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,6,0,0"/> </StackPanel> </DataTemplate> </Page.Resources>
<ListView Grid.Row="2" x:Name="WrapPanelContainer" IsItemClickEnabled="True" SelectionMode="Extended" Style="{StaticResource ListViewAppleStyle}" ItemsSource="{x:Bind Mode=OneWay, Path=SegTagItems}" ItemTemplate="{StaticResource WordsTemplate}"> <ListView.ItemsPanel> <ItemsPanelTemplate> <controls:WrapPanel /> </ItemsPanelTemplate> </ListView.ItemsPanel> <ListView.ItemContainerStyle> <Style TargetType="ListViewItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Stretch" /> <Setter Property="Height" Value="36" /> <Setter Property="MinHeight" Value="36" /> <Setter Property="Padding" Value="2"/> </Style> </ListView.ItemContainerStyle> </ListView>
然后就可以开心的显示了
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
不开玩笑,阿里人真的靠脸吃饭了
这阵子,阿里的程序猿们倒腾完自己家的商店又倒腾了食堂。 今天橙子去食堂用餐,一整条餐线居!然!都!没!有!服!务!员! 没人管的餐厅,靠脸吃饭,感受一下。 徜徉在食物的海洋里。 1秒算出用餐价格。 最后,凑上我英俊潇洒的脸,biu~支付成功! 为了节省排队时间,餐厅还给争分夺秒的阿里人,提供了无人餐柜,手机预约即可自由前往取餐。 这个可以预约就餐的在线应用,同学们还可以查询到自己的用餐记录和餐厅排队情况。马上还将上线膳食组成、热量计算、饮食建议等更多智能功能。 做无人餐厅项目,最大的难点在于快速识别菜品,计算价格,这需要改造餐线的机台和餐盘,成本昂贵。于是,项目组自主研发了图像识别算法,不仅节省了改造成本,还提高了识别精准度。当然,为了可以精准识别每一道菜,研发的代价就是每个人都吃胖了10斤。 只要你有一颗改变世界的心,吃货也能用黑科技改变生活。 原
- 下一篇
阿里云如何在阿里电商平台每天产生的2千万条商品评价中,高效甄别出净负面评论并跟进处理的?
近年来,电商发展的如火如荼,从以淘宝为首的网购零售平台再到垂直的生鲜类等电商,中国电商市场正持续较快地增长。据消息称,手机淘宝DAU在6月18日达到2.6亿的峰值,并且从去年开始,阿里电商平台推出促进消费者评价制度,买家评价字数多,配图多的能提高分值。这一举动拉高了用户商品评价率,但是也为恶意评价防控除了新的难题。 阿里电商平台平均每天产生2千万条商品评价。评价内容不仅体现卖家的口碑信誉,影响消费者的下单判断,而且这也是获取消费者反馈互动的最直接方式。 品牌商从中可以解析出商品最吸引人的卖点,以及最需要改进的地方,进而获知当前的消费者理念,预判流行趋势,提高购买转化。当一个卖家每天产生数百条商品评价时,假如用人工方式逐条甄别好评、差评,摘录收集消费者反馈的关键点,平均需要占用两名客服人员的工时;一旦遇上营销活动或者大促,则所需的工时更
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- Docker安装Oracle12C,快速搭建Oracle学习环境
- 设置Eclipse缩进为4个空格,增强代码规范
- SpringBoot2整合Thymeleaf,官方推荐html解决方案
- CentOS6,CentOS7官方镜像安装Oracle11G
- MySQL8.0.19开启GTID主从同步CentOS8
- CentOS7编译安装Cmake3.16.3,解决mysql等软件编译问题
- Linux系统CentOS6、CentOS7手动修改IP地址
- CentOS关闭SELinux安全模块
- CentOS7,CentOS8安装Elasticsearch6.8.6
- SpringBoot2配置默认Tomcat设置,开启更多高级功能