文本摘要根据不同的分类标准可以划分为多种类型。按照数据有无标注,可以分为有监督和无监督两种。
文本摘要按照输入类型可分为单文档摘要和多文档摘要。
优点:在语法、句法上有一定的保证;
缺点:内容选择错误、连贯性差、灵活性差
抽取式方法从原文中选取关键词或关键句组成摘要。这种方法在语法、句法上错误率低,保证了一定的效果。
传统的方法:使用图方法、聚类等方式来完成无监督摘要。主要包含Lead-3、Text Rank和聚类三种。
目前流行的方法:将问题建模为序列标注和句子排序两类任务。
优点:允许摘要中包含新的词语或短语,灵活性高
缺点:生成过程往往缺少关键信息的控制和指导
目前流行:序列到序列(Seq2Seq)模型被广泛地用于生成式摘要任务,并取得一定的成果。
考虑到基于Seq2Seq的模型往往对 长文本的生成不友好 ,可以使用 真实摘要 来指导文本摘要的生成。其核心想法在于:相似句子的摘要也具有一定相似度,将这些摘要作为软模板,作为外部知识来进行辅助。
摘要任务可以大致分为两步,首先选择重要内容,其次进行内容改写。
生成式神经网络模型的基本结构主要由编码器(Encoder)和解码器(Decoder)组成,编码和解码都由神经网络实现。
贪心搜索算法,集束搜索算法
经典文本摘要基线模型:结合注意力机制的Seq2Seq的文本摘要模型和指针生成网络模型
参考这个文章:
获取音乐文件的摘要属性
'引用Microsoft Shell Controls And Automation
Private Sub Command1_Click()
MsgBox getfilePTY("G:\音乐\亲爱的你怎么不在我身边wma")
End Sub
Function getfilePTY(strFl As String) As String
Dim fso 'As FileSystemObject
Dim fl 'As ScriptingFile
Dim pth As String
Dim flname As String
Dim shl As Shell32Shell
Dim shfd As Shell32Folder
Dim s As String
Dim i
'Set fso = New FileSystemObject
Set fso = CreateObject("scriptingfilesystemobject")
Set fl = fsoGetFile(strFl)
pth = flParentFolderPath
flname = flName
Set shl = New Shell
Set shfd = shlNameSpace(pth)
For i = 0 To 33
If shfdGetDetailsOf(0, i) <> "" Or shfdGetDetailsOf(shfdItemsItem(flname), i) <> "" Then
s = s & shfdGetDetailsOf(0, i) & ": " & shfdGetDetailsOf(shfdItemsItem(flname), i) & Chr(10)
End If
Next i
getfilePTY = s
End Function
using System;
using SystemCollectionsGeneric;
using SystemText;
namespace SnhjCmsCommon
{
/// <summary>
/// 处理类
/// </summary>
public static class PictureUtil
{
/// <summary>
/// 生成缩略图
/// </summary>
/// <param name="imgPath">原路径</param>
/// <param name="breviaryPath">缩略图路径</param>
/// <param name="width">缩略图宽度</param>
/// <param name="height">缩略图高度</param>
/// <param name="mode">生成方式</param>
public static void MakeBreviaryPhoto(string imgPath, string breviaryPath, int width, int height, string mode)
{
SystemDrawingImage image = SystemDrawingImageFromFile(imgPath);
int x = 0, y = 0;
int w = imageWidth;
int h = imageHeight;
switch (mode)
{
case "HW"://指定高度和宽度缩放(会变形)
break;
case "W"://指定宽度缩放,高度按比例。
height = h width / w;
break;
case "H"://指定高度缩放,宽度按比例。
width = w height / h;
break;
case "Cut"://指定高度和宽度裁剪。
if ((double)w / (double)h > (double)width / (double)height)
{
w = h width / height;
x = (imageWidth - w) / 2;
}
else
{
h = w height / width;
y = (imageHeight - h) / 2;
}
break;
default:
break;
}
//创建一个bmp
SystemDrawingImage bmpImg = new SystemDrawingBitmap(width, height);
//新建一个画板
SystemDrawingGraphics g = SystemDrawingGraphicsFromImage(bmpImg);
//设置高质量插值法
gInterpolationMode = SystemDrawingDrawing2DInterpolationModeHigh;
//设置高质量,低速度呈现平滑程度
gSmoothingMode = SystemDrawingDrawing2DSmoothingModeHighQuality;
//清空画布并以透明背景色填充
gClear(SystemDrawingColorTransparent);
//在指定位置并且按指定大小绘制原的指定部分
gDrawImage(image, new SystemDrawingRectangle(0,0,width,height), new SystemDrawingRectangle(x,y,w,h), SystemDrawingGraphicsUnitPixel);
try
{
//以jpg格式保存缩略图
bmpImgSave(breviaryPath, SystemDrawingImagingImageFormatJpeg);
}
catch (Exception e)
{
throw e;
}
finally
{
imageDispose();
bmpImgDispose();
gDispose();
}
}
/// <summary>
/// 加水印
/// </summary>
/// <param name="filename">文件名</param>
/// <param name="watermarkFilename">水印文件名</param>
/// <param name="watermarkStatus">水印位置:0=不使用 1=左上 2=中上 3=右上 4=左中 9=右下</param>
/// <param name="quality">是否是高质量 取值范围0--100</param>
/// <param name="watermarkTransparency">水印透明度 取值范围1--10 (10为不透明)</param>
public static void AddImageSignPic(string Path, string filename, string watermarkFilename, int watermarkStatus, int quality, int watermarkTransparency)
{
SystemDrawingImage img = SystemDrawingImageFromFile(Path);
SystemDrawingGraphics g = SystemDrawingGraphicsFromImage(img);
//设置高质量插值法
//gInterpolationMode = SystemDrawingDrawing2DInterpolationModeHigh;
//设置高质量,低速度呈现平滑程度
//gSmoothingMode = SystemDrawingDrawing2DSmoothingModeHighQuality;
SystemDrawingImage watermark = new SystemDrawingBitmap(watermarkFilename);
if (watermarkHeight >= imgHeight || watermarkWidth >= imgWidth)
{
return;
}
SystemDrawingImagingImageAttributes imageAttributes = new SystemDrawingImagingImageAttributes();
SystemDrawingImagingColorMap colorMap = new SystemDrawingImagingColorMap();
colorMapOldColor = SystemDrawingColorFromArgb(255, 0, 255, 0);
colorMapNewColor = SystemDrawingColorFromArgb(0, 0, 0, 0);
SystemDrawingImagingColorMap[] remapTable = { colorMap };
imageAttributesSetRemapTable(remapTable, SystemDrawingImagingColorAdjustTypeBitmap);
float transparency = 05F;
if (watermarkTransparency >= 1 && watermarkTransparency <= 10)
{
transparency = (watermarkTransparency / 100F);
}
float[][] colorMatrixElements = {
new float[] {10f, 00f, 00f, 00f, 00f},
new float[] {00f, 10f, 00f, 00f, 00f},
new float[] {00f, 00f, 10f, 00f, 00f},
new float[] {00f, 00f, 00f, transparency, 00f},
new float[] {00f, 00f, 00f, 00f, 10f}
};
SystemDrawingImagingColorMatrix colorMatrix = new SystemDrawingImagingColorMatrix(colorMatrixElements);
imageAttributesSetColorMatrix(colorMatrix, SystemDrawingImagingColorMatrixFlagDefault, SystemDrawingImagingColorAdjustTypeBitmap);
int xpos = 0;
int ypos = 0;
switch (watermarkStatus)
{
case 1:
xpos = (int)(imgWidth (float)01);
ypos = (int)(imgHeight (float)01);
break;
case 2:
xpos = (int)((imgWidth (float)50) - (watermarkWidth / 2));
ypos = (int)(imgHeight (float)01);
break;
case 3:
xpos = (int)((imgWidth (float)99) - (watermarkWidth));
ypos = (int)(imgHeight (float)01);
break;
case 4:
xpos = (int)(imgWidth (float)01);
ypos = (int)((imgHeight (float)50) - (watermarkHeight / 2));
break;
case 5:
xpos = (int)((imgWidth (float)50) - (watermarkWidth / 2));
ypos = (int)((imgHeight (float)50) - (watermarkHeight / 2));
break;
case 6:
xpos = (int)((imgWidth (float)99) - (watermarkWidth));
ypos = (int)((imgHeight (float)50) - (watermarkHeight / 2));
break;
case 7:
xpos = (int)(imgWidth (float)01);
ypos = (int)((imgHeight (float)99) - watermarkHeight);
break;
case 8:
xpos = (int)((imgWidth (float)50) - (watermarkWidth / 2));
ypos = (int)((imgHeight (float)99) - watermarkHeight);
break;
case 9:
xpos = (int)((imgWidth (float)99) - (watermarkWidth));
ypos = (int)((imgHeight (float)99) - watermarkHeight);
break;
}
gDrawImage(watermark, new SystemDrawingRectangle(xpos, ypos, watermarkWidth, watermarkHeight), 0, 0, watermarkWidth, watermarkHeight, SystemDrawingGraphicsUnitPixel, imageAttributes);
SystemDrawingImagingImageCodecInfo[] codecs = SystemDrawingImagingImageCodecInfoGetImageEncoders();
SystemDrawingImagingImageCodecInfo ici = null;
foreach (SystemDrawingImagingImageCodecInfo codec in codecs)
{
if (codecMimeTypeIndexOf("jpeg") > -1)
{
ici = codec;
}
}
SystemDrawingImagingEncoderParameters encoderParams = new SystemDrawingImagingEncoderParameters();
long[] qualityParam = new long[1];
if (quality < 0 || quality > 100)
{
quality = 80;
}
qualityParam[0] = quality;
SystemDrawingImagingEncoderParameter encoderParam = new SystemDrawingImagingEncoderParameter(SystemDrawingImagingEncoderQuality, qualityParam);
encoderParamsParam[0] = encoderParam;
if (ici != null)
{
imgSave(filename, ici, encoderParams);
}
else
{
imgSave(filename);
}
gDispose();
imgDispose();
watermarkDispose();
imageAttributesDispose();
}
/// <summary>
/// 在上生成水印
/// </summary>
/// <param name="Path">原服务器路径</param>
/// <param name="Path_syp">生成的带水印的路径</param>
/// <param name="Path_sypf">水印路径</param>
public static void AddWaterPic(string Path, string Path_syp, string Path_sypf)
{
SystemDrawingImage image = SystemDrawingImageFromFile(Path);
SystemDrawingImage copyImage = SystemDrawingImageFromFile(Path_sypf);
SystemDrawingGraphics g = SystemDrawingGraphicsFromImage(image);
gDrawImage(copyImage, new SystemDrawingRectangle(imageWidth - copyImageWidth, imageHeight - copyImageHeight, copyImageWidth, copyImageHeight), 0, 0, copyImageWidth, copyImageHeight, SystemDrawingGraphicsUnitPixel);
gDispose();
imageSave(Path_syp);
imageDispose();
}
}
}
以上就是关于文本自动摘要生成全部的内容,包括:文本自动摘要生成、VB 如何实现修改有文件摘要中的摘要信息中的各栏目信息、如何通过c#读写图片(JPG格式)的摘要信息等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)