list manipulation – Finding and numbering sublists


I implemented the following routine.

array1 = {12, -12, 14, 12, 1, -3, 1, 1, 2, 7, 8, 102, 2, 3, 3, 1, 332,
11, 23, 2, -2, 13, 12, 1, 1, 1, 1, 1, 1, 1, 1, 121, 131};

I want to find sub-lists composed of consecutive numbers whose absolute values ​​are below a certain threshold (Lim = 5). I also want to have a parameter for the length of the sublists (Len = 3).

Module[{Ar, Pos, Lim, Len},
 Ar = #;
 Lim = 5;
 Len = 3;
 Position[Ar, x_ /; Abs[x] < Lim] // Flatten[#] & // Set[Pos, #] &;
 Select[Split[Pos, #2 - #1 == 1 &], Length[#] >    Len &]]And[array1] // Together[PosInt, #] &;

Now I have the sub-lists positions.

PosInt // Print;
{{5,6,7,8,9}, {13,14,15,16}, {24,25,26,27,28,29}}

The next thing I would like to have is a table that includes the number and position of sub-lists. I have the following solution.

array2 = ConstantArray[0, Length@array1];
Module[{IntNum, Num, Pos},
Pos = #;
MapIndexed[(
IntNum = First @ # 2;
Num = # 1;
Map[(Array2[[(Array2[[(array2[[(array2[[#]]= IntNum
) &, Num];
) &, Pos]]And[PosInt];

The desired result is saved as array2.

array2 // Print;
{0,0,0,0,1,1,1,1,0,0,0,2,2,2,2,0,0,0,0,0,0,0,3,3,3 , 3,3,3,3,0,0}

My implementation gives the right result. Nevertheless, I am sure that it is possible to find a more elegant solution. Do you have any suggestions?